does a mailitem have to be displayed (in an inspector) to be printed?

  • Thread starter Thread starter AJ
  • Start date Start date
A

AJ

I have an application that I think I tested to the point where:

If I want to use mailItem.PrintOut, I have to first do an
Inspector.Activate.

Can anyone confirm if there is a VBA/COM way to do a mailItem.PrintOut
without displaying the mail in an inspector?

Thanks in advance,
AJ
 
Displaying the item is a requirement only for HTML messages. An alternative
would be to save the item as an .htm file, open it in Word and use Word's
methods to print.
 
Is there a SaveAs() with html format? I don't think I've seen that. Can
you be more specific as to how to save the email in HTML format? (I think I
can figure out the rest from there. ;)

Thanks!
-AJ
 
When in doubt, check the object browser: Press ALt+F11 to open the VBA
environment in Outlook, then press F2. Switch from <All Libraries> to
Outlook to browse all Outlook objects and their properties, methods, and
events. Select any object or member, then press F1 to see its Help topic. If
you read the Help topic for SaveAs, you'll see that the format parameter
includes HTML -- only for HTML-format messages, of course.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
OK, that sort-of works, except now I run into the Security Dialog. I guess
a HTML SaveAs() requires access to the Recipients props?
I tried Redemption, but the current versions doesn't seem to over-ride the
SaveAs for HTML "type".

Any ideas on keeping the Security Dialog at bay?

Thanks!
-AJ
 
Show your Redemption code for SaveAs.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Dim orMsgItem As Redemption.MessageItem
....

If (Len(orMsgItem.HTMLBody)) Then
DebugMsg "Detected HTML Mail..."
DebugMsg "Saving HTML Mail as HTML File"
orMsgItem.SaveAs sHTMLRend, olHTML
....
 
Show how you're setting the Item property for orMsgItem.

What version of Outlook and Redemption?

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
oMailItem.Save

sEntryID = oMailItem.EntryID
sStoreID = oDefFldr.StoreID
DebugMsg "Pre-Close"
oMailItem.Close olDiscard
Set oMailItem = Nothing
DebugMsg "sEntryID = " & sEntryID
DebugMsg "sStoreID = " & sStoreID

Set orMsgItem = oImpMsg.GetItemFromID(sEntryID, sStoreID)

' *** Outlook 2K3 with Redemption 3.4
 
Back
Top