in reply to Re: Win32::OLE - copying and pasting outlook body and pasting to Word
in thread Win32::OLE - copying and pasting outlook body and pasting to Word

n00b question here. I am an MS-Office 2007 user, and am using Win32::OLE. I have an outlook email in HTML format as specified here:

#start Outlook and make it visible my $Outlook = Win32::OLE->GetActiveObject ('Outlook.Application') || Win32::OLE->new('Outlook.Application'); $Outlook->{'Visible'} = 1; my $message = $Outlook->CreateItem(olMailItem); $message->{BodyFormat} = 'olFormatHTML'; #needed for rich format #use a hash to populate address and subject fields $message->{HTMLBody} = $emailBody; my $clip = Win32::Clipboard($message->{HTMLBody});

If I manually copy and paste my email body from Outlook to Word, it copies fine, resulting in RTF in Word. Programatically though (see code snippet above), it seems to be copying straight HTML code to the clipboard. Then when pasted to Word, it comes out as HTML code, not the RTF I desire. How can i programatically copy and paste from the Outlook email body to Word so that it ends up as rich text?
  • Comment on Re^2: Win32::OLE - copying and pasting outlook body and pasting to Word
  • Download Code

Replies are listed 'Best First'.
Re^3: Win32::OLE - copying and pasting outlook body and pasting to Word
by Anonymous Monk on Sep 25, 2009 at 01:59 UTC