Putting Excel table in Outlook MailItem using VBA

petereddy

New Member
Joined
Feb 6, 2014
Messages
43
Hi,

The following Excel code drafts a simple email in Outlook:
Code:
Sub testerrrrrrrrr()
    Set myItem = Outlook.CreateItem(olMailItem)
    myItem.To = "a.b@c.com"
    myItem.Subject = "Test"
    myItem.Body = "Two words."
    myItem.Display
End Sub

I have a table in Excel (it's a calendar) that I would like to get in the body of the email. Is there a way to automate this with VBA? I think there are no simple MailItem properties that will enable me to get the table into the body of the email.

If I were doing this manually, I'd copy the table, move into the Outlook email, and paste it. Is there a way to automate this process?

I mentioned above that there are no simple MailItem properties to do this. I think I could code the table in HTML. Once it's in HTML, it can be written into the MailItem Body property. Is there an easy way to get the HTML code of the table? Thanks for your help.

Peter
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Thanks for pointing me to this link. Saving the file as a webpage, then extracting the HTML is a great idea. :)
 
Upvote 0

Forum statistics

Threads
1,223,904
Messages
6,175,295
Members
452,632
Latest member
jladair

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