Put the messages to process in a sub folder of Inbox and run the macro ProcessFolder below. You can test it by selecting a single message and run the macro ProcessAttachment.
Option Explicit
#If Win64 Then
Public Declare PtrSafe Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, _
ByVal lpOperation As String, ByVal lpFile As String, _
ByVal lpParameters As String, ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
#Else
Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, _
ByVal lpOperation As String, ByVal lpFile As String, _
ByVal lpParameters As String, ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
#End If
Sub ProcessAttachment()
'Graham Mayor - http://www.gmayor.com - Last updated - 02 Sep 2017 Dim olMsg As MailItem
Dim olMsg As MailItem
On Error Resume Next
Set olMsg = ActiveExplorer.Selection.Item(1)
PrintAttachments olMsg
lbl_Exit:
Set olMsg = Nothing
Exit Sub
End Sub
Sub ProcessFolder()
'Graham Mayor - http://www.gmayor.com - Last updated - 02 Sep 2017
Dim olNS As Outlook.NameSpace
Dim olMailFolder As Outlook.MAPIFolder
Dim olItems As Outlook.Items
Dim olMailItem As MailItem
On Error GoTo err_Handler
Set olNS = GetNamespace("MAPI")
Set olMailFolder = olNS.PickFolder
Set olItems = olMailFolder.Items
For Each olMailItem In olItems
PrintAttachments olMailItem
DoEvents
End If
Next olMailItem
err_Handler:
Set olNS = Nothing
Set olMailFolder = Nothing
Set olItems = Nothing
Set olMailItem = Nothing
lbl_Exit:
Exit Sub
End Sub
Private Sub PrintAttachments(olItem As MailItem)
'Graham Mayor - http://www.gmayor.com - Last updated - 02 Sep 2017
Dim olAttach As Attachment
Dim strFname As String
Dim strExt As String
Dim j As Long
Dim strSaveFldr As String
strSaveFldr = Environ("TEMP") & "\"
On Error GoTo lbl_Exit
If olItem.Attachments.Count > 0 Then
For j = 1 To olItem.Attachments.Count
Set olAttach = olItem.Attachments(j)
If LCase(olAttach.fileName) Like "*.pdf" Then
strFname = olAttach.fileName
olAttach.SaveAsFile strSaveFldr & strFname
NewShell strSaveFldr & strFname, 0
DoEvents
End If
Next j
End If
lbl_Exit:
Set olAttach = Nothing
Set olItem = Nothing
Exit Sub
End Sub
Private Sub NewShell(cmdLine As String, lngWindowHndl As Long)
ShellExecute lngWindowHndl, "print", cmdLine, "", "", 0
lbl_Exit:
Exit Sub
End Sub