M
MattS
Hello! It was suggested in the MSDN forums that I post my question here.
It's not VBA specific, though it pertains to Outlook interop with Visual
Basic. If there's a better place to post this, please let me know.
In a Visual Basic .NET 1.1 application which I wrote and have been
maintaining, I'm observing a strange behavior on one system (but not the
other systems I've installed it on). The application uses Outlook interop to
communicate with Outlook 2003 and saves select email messages for further
processing. When saving messages, based on the MailItem's BodyFormat I call
the MailItem's SaveAs method with the matching Outlook.OlSaveAsType
parameter. For instance, and with some code removed for clarity:
If curItem.BodyFormat = Outlook.OlBodyFormat.olFormatHTML Then
curItem.SaveAs(fn, Outlook.OlSaveAsType.olHTML)
ElseIf curItem.BodyFormat = Outlook.OlBodyFormat.olFormatPlain Then
curItem.SaveAs(fn, Outlook.OlSaveAsType.olTXT)
ElseIf curItem.BodyFormat = Outlook.OlBodyFormat.olFormatRichText Then
curItem.SaveAs(fn, Outlook.OlSaveAsType.olTXT)
ElseIf curItem.BodyFormat = Outlook.OlBodyFormat.olFormatUnspecified Then
curItem.SaveAs(fn, Outlook.OlSaveAsType.olTXT)
End If
I haven't had problems so far saving rich text messages as plain text, and
anything unspecified getting saved as plain text works fine for my purposes.
The problem is that on this particular workstation when an HTML message is
saved there are character encoding problems in the resulting html file.
These encoding problems only affect certain punctuation such as em dash,
apostrophe, and tildes. The html file resulting from the MailItem.SaveAs
has, for example � instead of – . If I interactively go into Outlook and
choose File > Save As, selecting html, the characters in question are saved
properly.
I am left feeling that because identical releases of the software on
different computers are behaving differently that it should be a problem with
some system setting on the computer in question. The version of the OS (XP
Pro) and Outlook (2003, SP3) are the same across these computers (though i
still need to get the specific version numbers looked up).
Does anyone have any thoughts on what would affect the formatting of the
SaveAs HTML output like this?
It's not VBA specific, though it pertains to Outlook interop with Visual
Basic. If there's a better place to post this, please let me know.
In a Visual Basic .NET 1.1 application which I wrote and have been
maintaining, I'm observing a strange behavior on one system (but not the
other systems I've installed it on). The application uses Outlook interop to
communicate with Outlook 2003 and saves select email messages for further
processing. When saving messages, based on the MailItem's BodyFormat I call
the MailItem's SaveAs method with the matching Outlook.OlSaveAsType
parameter. For instance, and with some code removed for clarity:
If curItem.BodyFormat = Outlook.OlBodyFormat.olFormatHTML Then
curItem.SaveAs(fn, Outlook.OlSaveAsType.olHTML)
ElseIf curItem.BodyFormat = Outlook.OlBodyFormat.olFormatPlain Then
curItem.SaveAs(fn, Outlook.OlSaveAsType.olTXT)
ElseIf curItem.BodyFormat = Outlook.OlBodyFormat.olFormatRichText Then
curItem.SaveAs(fn, Outlook.OlSaveAsType.olTXT)
ElseIf curItem.BodyFormat = Outlook.OlBodyFormat.olFormatUnspecified Then
curItem.SaveAs(fn, Outlook.OlSaveAsType.olTXT)
End If
I haven't had problems so far saving rich text messages as plain text, and
anything unspecified getting saved as plain text works fine for my purposes.
The problem is that on this particular workstation when an HTML message is
saved there are character encoding problems in the resulting html file.
These encoding problems only affect certain punctuation such as em dash,
apostrophe, and tildes. The html file resulting from the MailItem.SaveAs
has, for example � instead of – . If I interactively go into Outlook and
choose File > Save As, selecting html, the characters in question are saved
properly.
I am left feeling that because identical releases of the software on
different computers are behaving differently that it should be a problem with
some system setting on the computer in question. The version of the OS (XP
Pro) and Outlook (2003, SP3) are the same across these computers (though i
still need to get the specific version numbers looked up).
Does anyone have any thoughts on what would affect the formatting of the
SaveAs HTML output like this?