Saving mail messages as html or rtf

  • Thread starter Thread starter Simon Kravis
  • Start date Start date
S

Simon Kravis

I need to save all the mail messages in an Outlook 2002 folder in a
format which preserves text formatting and is readable by other
programs. Checking the MailItem.SaveAs method it provides the options
olDoc, olHTML, olMSG, olRTF, olTemplate, olTXT, olVCal, or olVCard.

Using folder with messages and the olRTF option

Dim M As Outlook.MailItem
For Each M In F3.Items
sSaveName = "D:\Data\TED\Mail Analyser\WBAA Posts\" & i & ".rtf"
M.SaveAs sSaveName, olRTF
i = i - 1
Next M

I get the runtime error "Could not complete operation. One on more
parameter values are not valid" on most of the files.

Changing the SaveAs option to olHTML, I find that files that do not
save as RTF will save as HTML, and those which will save as RTF will
not save as HTML.

I notice the Save As options may include either html or rtf in the
message window. How is Outlook deciding this? Is it possible to save
in just one format?

Simon Kravis
 
You can only save as RTF if the original message was in RTF. Same thing for
HTML. Use the BodyFormat property to determine the format before saving.
 
Back
Top