Access the answers to your technology questions today.
Subscribe Now
30-day free trial. Register in 60 seconds.
What Makes Experts Exchange Unique?
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.
Try it out and discover for yourself.
Subscribe Now
30-day free trial. Register in 60 seconds.
Join the Community
Give a Little. Get a Lot.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Join the Community
by: stefriPosted on 2003-06-04 at 12:02:12ID: 8651306
Open VBA (Alt F11)
ication")
tion Wscript.Sh ell")
Cut and paste the code between ' snips
Assign the macro to a button:
right click the standard toolbar,
customize
Command Tab
Macros: drag and drop printPDFAttachment to the toolbar
To use the button, select a mail with pdf attachment then click you button
Yoy may be have to change the value of the variable acrobatPrint which if is for Distiller (check the associated program in Explorer: Folder Option, File Type
look for pdf, select print then modify, copy the command line to be used in the variable getting rid of %1)
tempFolder points to c:\temp where are saved the attached pdfs.
Good luck
Stefri
PS: I do not have mail with pdf for the moment, try first on a mail with at most 2 attachments.... :-D (just in case....)
' snips
Sub printPDFAttachment()
Dim olApp As Outlook.Application
Dim it As Object
Dim att As Outlook.Attachment
Dim intPos As Integer
Dim strExt As String
Dim wshShell As Object
Dim cmdLine As String
Dim strRun As String
Dim sel As Outlook.Selection
Dim myTempFolder As String
Dim acrobatPrint As String
acrobatPrint = "Acrobat.exe /p /h "
myTempFolder = "c:\temp"
Set olApp = Application ' CreateObject("Outlook.appl
Set sel = olApp.ActiveExplorer.Selec
For Each it In sel
If it.Class = olMail Then
For Each att In it.Attachments
intPos = InStrRev(att.FileName, ".")
strExt = LCase(Mid(att.FileName, intPos + 1))
If strExt = "pdf" Then
att.SaveAsFile myTempFolder & "\" & att.DisplayName
Set wshShell = Application.CreateObject("
cmdLine = acrobatPrint & myTempFolder & "\" & att.DisplayName
strRun = wshShell.Run(cmdLine, 1, True)
wshShell.Quit
Set wshShell = Nothing
End If
Next
End If
Next
Set sel = Nothing
Set olApp = Nothing
End Sub
' snips