Trying to Acces the readyState property for printing Outlook HTML messages

R

RichW

Good morning.

I am using the XP PIA and .NET.

For HTML emails that I print programmatically, I often get an error
message. I asked for some help on this and it was recommended (by Sue
Mosher - thank you!) that I use Inspector.HTMLEditor to return an
HTMLDocument object, then loop until its readystate property returns
Complete. So, I started on the following snippet and I am having
problems.

(using reference Microsoft.mshtml)

(oMsg is a reference to a mailItem):

Microsoft.Office.Interop.Outlook.MailItem MI =
(Microsoft.Office.Interop.Outlook.MailItem) oMsg;
IHTMLDocument2 oInspect;

Microsoft.Office.Interop.Outlook.Inspector Inspect =
(Microsoft.Office.Interop.Outlook.Inspector) MI.GetInspector;

// Here is where I use Inspector.HTMLEditor to return an HTMLDocument
object
oInspect = Inspect.HTMLEditor;

Unfortunately, the above statement does not compile. I get the error:
Cannot implicitly convert type 'object' to 'mshtml.IHTMLDocument2'

Any ideas? I am flummoxed here.

All the best,

- Rich
 

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

Similar Threads


Top