none
Save populated Client Userform for emailing RRS feed

  • Question

  • I have developed a userform to track customer refunds.  I can save the data entered and print the populated userform but need a method incorporated into the code that will allow me to save the populated userform in its designed state to email to our office.
    Saturday, October 27, 2012 12:24 AM

All replies

  • As far I understand - If you want to print form use this method

    to module:

    Public Declare Sub keybd_event Lib "user32" ( _
        ByVal bVk As Byte, ByVal bScan As Byte, _
        ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
    
    Public Const VK_SNAPSHOT = &H2C
    
    Sub ShowForm()
    your_form.show 0 'show modal ONLY
    end sub

    in form:

    Private Sub PrintButton_Click()
       Application.ScreenUpdating = False
        
       keybd_event VK_SNAPSHOT, 1, 0, 0
       Application.Wait Now + TimeValue("00:00:01")
      
       Me.Hide
       Workbooks.Add
    
       With ActiveSheet
          .Pictures.Paste
          .PageSetup.CenterHorizontally = True
          .PageSetup.CenterVertically = True
          .PrintPreview
       End With
        
       ActiveWorkbook.Close False
       Application.ScreenUpdating = True
        Me.Show
    End Sub

    And now you can send email with the screan.

    Regards.


    Oskar Shon, Office System MVP

    Press if Helpful; Answer when a problem solved

    Saturday, October 27, 2012 11:10 AM
    Answerer
  • Depending on which application you are using, I would have a separate button to create a printable or email version. I would export the data to Excel as a most useful format. You can then email the Excel Workbook.

    Rod Gill

    The one and only Project VBA Book

    Rod Gill Project Management

    Sunday, October 28, 2012 8:33 PM