Putting Excel table in Outlook MailItem using VBA

petereddy

New Member
Joined
Feb 6, 2014
Messages
33
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
 

Some videos you may like

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

petereddy

New Member
Joined
Feb 6, 2014
Messages
33
Thanks for pointing me to this link. Saving the file as a webpage, then extracting the HTML is a great idea. :)
 

Watch MrExcel Video

Forum statistics

Threads
1,099,569
Messages
5,469,462
Members
406,653
Latest member
CBeeker

This Week's Hot Topics

Top