Inserting Userform into Outlook Email - Help

maxL123

New Member
Joined
Feb 12, 2014
Messages
5
Hi All -

I have spreadsheet that lists different tasks the user may want a support team to complete. Ideally, the user can click a button next to activity name which would open up a userform displaying certain options, fields for information,etc.

There would then be a button at the bottom of the userform that would be tied to VBA - opening up Outlook, automatically populating the To field and subject line, as well as inserting the userform, or at least the information that it contains.

I have been able to figure out how to open Outlook, populate the TO and subject lines, but cannot figure out how to transfer the userform into the body of the email.

Any thought?

Code:
 Private Sub CommandButton1_Click()

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

    On Error Resume Next
    With OutMail
        .To = "ESS_CSST@ntrs.com"
        .CC = ""
        .BCC = ""
        .Subject = "Open Account of GAM-PAO"
        
        '[B]body of email goes here[/B]
                   
'Body =
 
                    
        
    End With
    On Error GoTo 0

    Set OutMail = Nothing
    Set OutApp = Nothing
End Sub
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Inserting the userform information (its control values) into the email is something like:

Code:
        .Body = "TextBox = " & UserForm1.TextBox1.Value & vbNewLine & _
                "CheckBox = " & UserForm1.CheckBox1.Value
where UserForm1 is the code name of the userform, and TextBox1 and CheckBox1 are names of controls on the form.

To insert the userform as an image in the email body, see http://www.mrexcel.com/forum/excel-...rform-into-outlook-mail-body.html#post3399520 for some ideas.
 
Upvote 0
Thank you. This is helpful.

The copy image route seems the best, but the links you posted seem too dense for me.

I appreciate it!
 
Upvote 0

Forum statistics

Threads
1,223,727
Messages
6,174,148
Members
452,547
Latest member
Schilling

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