-
Putting Tabled Outlook Date Into Clipboard
Hello,
I?m currently working on a project to pull data out of an outlook 2003 email and copy it to the clipboard for use in Word. The information is presented in a table that when copied manually will drop directly into word with the formatting intact for me to manipulate there, however when I try to automate with a macro doing the select all and copy action, the formatting is completely dropped. Here is what I have:
Sub Pull()
Dim dataobj As DataObject
Dim olExp As Explorer
Dim olMail As mailItem
Set olExp = Application.ActiveExplorer
Set olMail = olExp.Selection.Item(1)
Set dataobj = New DataObject
With dataobj
.ClearTest1
.SetText olMail.Body
.PutInClipboard
End With
End Sub
Thanks,
John
-
Knowledge Base Approver
The King of Overkill!
VBAX Master
Hi John,
The DataObject can only store text and not formatting; so when you add the olMail.Body to the clipboard it is only storing the flat text. Since your data is in a table it is likely in HTML Format, try using .SetText olMail.HTMLBody instead, should give you the results you're looking for. Otherwise you could always save the email as an .html file and open that in Word.
Matt
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules