Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print email from code

Status
Not open for further replies.

petermeachem

Programmer
Aug 26, 2000
2,270
GB
This is driving me demented.
I have a toolbar button that calls up a form and does various things with the information in the email. One of the things I need it to do is to print the email. I cannot find out how to do this and would really appreciate it if someone could point me in the right direction
 
I suppose I should have mentioned this is an Outlook vba problem
 
The answer is
Public Sub PrintSelectedEmails()

Dim oOutlook As Outlook.Application
Dim oNamespace As Outlook.NameSpace
Dim oMailItem As Outlook.MailItem
Dim i As Long

Set oNamespace = Application.GetNamespace("MAPI")
For i = 1 To Application.ActiveExplorer.Selection.Count
Set oMailItem = Application.ActiveExplorer.Selection.Item(i)
Set oMailItem = Application.ActiveExplorer.Selection.Item(i)
oMailItem.PrintOut
Next i

Set oMailItem = Nothing
Set oNamespace = Nothing

End Sub
Simple really
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top