Take a snapshot of a userform

kryptonian

Board Regular
Joined
Oct 6, 2006
Messages
104
Hi,

I have a userform with text boxes, combo, boxes,etc and I want to take a snapshot of it so I can paste it in either outlook or lotus notes email. Basically, this should be like a printscreen function but should only get the image of the userform.

How do i do this in VBA, if possible? I will be using a command button to activate when to take the snapshot.

Thanks in advance!
 
Hey guys, I was pointed in your direction for this topic and...

1. The code works AWESOME!!!!
2. I am trying to add one more step to this. Right now I have the code running and when I click the button on the page, first it calls your code to take the snapshot. NEXT it calls an 'email' sub which looks like this.

Code:
Sub Email()
    Dim OutApp As Object, OutMail As Object
    Dim Email As String, Center As String
    Dim FormImage As Image

    On Error GoTo Email_Error

    Email = frmCenterLookup.txtDevelopmentManager.Value
    Center = frmCenterLookup.txtCenterConfirm.Value

    Set rng = Nothing
    On Error Resume Next

    On Error GoTo 0

    With Application
        .EnableEvents = False
        .ScreenUpdating = False
    End With

    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)

    On Error Resume Next
    With OutMail
        .To = Email & "TEST"
        .Subject = "Center " & Center & " Inquiry"
        .HTMLBody =  [COLOR="Red"]<--- I want the copied snapshot here. [/COLOR]
        .Display

    End With
    On Error GoTo 0

    With Application
        .EnableEvents = True
        .ScreenUpdating = True
    End With

Email_Exit:
    Set OutMail = Nothing
    Set OutApp = Nothing

    On Error GoTo 0
    Exit Sub

Email_Error:

    MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure Email of Module EmailCode"
    Err.Clear
    GoTo Email_Exit

End Sub

What I would like to do, is paste the copied snapshot into the body of the email at the spot indicated above.

Can you help point me on how to do this?
 
Upvote 0

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
theres a lot you can do with this let me know if you need help.

whats above will only take a snapshot of the userform the button is on

so if you want it to do other things it should be w/ the same 3 lines of code. ie; automatically populate your email with it

What would be the code to export this just to notepad, or merely the clipboard as a text file formatted "copy" function? The end goal would be to paste in to JDEdwards which only uses a flat file formatted editing box.
 
Upvote 0

Forum statistics

Threads
1,216,043
Messages
6,128,470
Members
449,455
Latest member
jesski

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top