SaveAs difference in Outlook VBA and COM Add-in

J

James Cameron

Can anyone please explain this? During my COM Add-in code development
I have been trying to use the Outlook OM SaveAs function. I have
discovered the following.

1. If I run Outlook 2000, choose an HTML message, then use the Alt +
F11 keys to flip to the VBA environment, I can then type in the
immediate window:

Debug.Print ActiveExplorer.Selection.Item(1).GetInspector.EditorType

this gives '2' which equals HTML format as you would expect.

I can then type:

ActiveExplorer.Selection.Item(1).SaveAs "C:\TEST.HTM", olHTML

This CORRECTLY saves the message to C:\TEST.HTM

2. I want to achieve the same thing in a COM Addin.

Code snippet:

Set objOLItem = ActiveExplorer.Selection.Item(1)
MsgType = objOLItem.GetInspector.EditorType

TempFile$ = "C:\TEST"

Select Case MsgType

Case 1 'Text
objOLItem.SaveAs TempFile$ & ".TXT", 0

Case 2 'HTML
objOLItem.SaveAs TempFile$ & ".HTM", 5

Case 3 'RTF
objOLItem.SaveAs TempFile$ & ".RTF", 1

End Select

This is OK with Text messages, but for HTML it only saves the items in
the Outlook Preview pane i.e. From/Sent/To/Subject - THERE IS NO HTML
BODY!!!!

Can someone please tell me why this should be as it is driving me
crazy!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top