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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing Attachments in Outlook

Status
Not open for further replies.

Metaliczombi

Technical User
Nov 25, 2002
58
US
I get multiple emails with attachments. The emails are generated from our mainframe automaticaly and the attachment is in RTF format. What I need is a way to print these attachments without having to manually go through the open attachment, wait, print method. I am very new to VB but give me the code and I will wotk with it till I like it. Help?
 
The Outlook Macro below should give you some ideas on how it can be done. It's not a finished product, but may get you started.

Sub PrintAttach()
Dim ns As NameSpace
Dim ib As MAPIFolder
Dim mi As MailItem, att As Attachment
Dim wo As Word.Application
Set ns = Application.GetNamespace("MAPI")
Set ib = ns.GetDefaultFolder(olFolderInbox)
Set mi = ib.Items(5)
Set att = mi.Attachments(1)
att.SaveAsFile "c:\temp\" & att.FileName
Set wo = New Word.Application
wo.Visible = False
wo.Documents.Open "c:\temp\" & att.FileName
wo.PrintOut Background:=False
wo.DisplayAlerts = False
wo.Quit
Set wo = Nothing
Set att = Nothing
Set ib = Nothing
Set ns = Nothing
End Sub

Rob
[flowerface]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top