Copy Current Excel Userform and paste in an Outlook message

RawlinsCross

Active Member
Joined
Sep 9, 2016
Messages
437
Good day,

I want to generate a report from various userforms I have in a workbook. My plan is to generate each userform separately and then copy and paste it to a WordEditor object in an outlook MailItem (I think). Setting up the email is fairly straight forward. I think I can manage calling each userform separately, but how do I then copy and paste each userform in turn into the email?

VBA Code:
Public Sub EmailReport()

Dim ol As Outlook.Application
Dim mi As Outlook.MailItem
Dim doc As Word.Document
Dim shpHeader As Word.InlineShape
Dim shpGraph1 As Word.InlineShape

Set ol = New Outlook.Application
Set mi = ol.CreateItem(olMailItem)

mi.To = "someone@somewhere.com"
mi.Subject = "Report"

Set doc = mi.GetInspector.WordEditor

Set shpHeader = doc.Range(0, 0).InlineShapes.AddPicture(Environ("USERPROFILE") & "\Pictures\ReportHeader.gif")
Set shpGraph1 = doc.Range(1, 1).InlineShapes.AddPicture(Environ("USERPROFILE") & "\Pictures\Graph1.gif") 'I tested this here, but would want this to be a paste of a userform.

mi.Display

End Sub
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

Forum statistics

Threads
1,214,593
Messages
6,120,434
Members
448,961
Latest member
nzskater

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