I must admit that I use this in Outlook 2003, but please see if it works in 2007:
you can use MSForms.DataObject to exchange data with the clipboard. In Outlook VBA, create a link to the " Microsoft Forms 2.0 Object Library " and try this code (you can, of course, attach Sub () to the button, etc.):
Sub Test() Dim M As MailItem, Buf As MSForms.DataObject Set M = ActiveExplorer().Selection.Item(1) Set Buf = New MSForms.DataObject Buf.SetText M.HTMLBody Buf.PutInClipboard End Sub
After that, go to Excel and press Ctrl-V - there we go! If you also want to find the current Excel application and automate it, let me know.
Valid HTMLBody always exists, even when mail has been sent to Plain Text or RTF, and Excel will display all text attributes passed to HTMLBody, incl. columns, colors, fonts, hyperlinks, indents, etc. However, embedded images are not copied.
This code demonstrates the essence, but does not check if MailItem is actually selected. This will require more coding if you want it to work for calendar entries, contacts, etc. Also.
It’s enough if you selected mail as a list, you don’t even need to open it.
Miked
source share