In order to print the attachments you first have to save them. You can do that from a suitable script e.g. PrintAttachments below.
This saves to the Temp folder then prints using the appropriate application. Test by selecting a message with an attachment and run TestPrint
Option Explicit
Sub TestPrint()
Dim olMsg As MailItem
On Error Resume Next
Select Case Outlook.Application.ActiveWindow.Class
Case olInspector
Set olMsg = ActiveInspector.currentItem
Case olExplorer
Set olMsg = Application.ActiveExplorer.Selection.Item(1)
End Select
PrintAttachments olMsg
lbl_Exit:
Exit Sub
End Sub
Public Sub PrintAttachments(olItem As MailItem)
'Graham Mayor - http://www.gmayor.com - Last updated - 26 May 2017
Dim olAttach As Attachment
Dim sName As String
Dim j As Long
Dim sPath As String
On Error Resume Next
sPath = Environ("TEMP") & "\"
If olItem.Attachments.Count > 0 Then
For j = 1 To olItem.Attachments.Count
Set olAttach = olItem.Attachments(j)
If Not olAttach.FileName Like "image*.*" Then
sName = olAttach.FileName
olAttach.SaveAsFile sPath & sName
PrintFile sPath & sName
End If
Next j
End If
lbl_Exit:
Set olAttach = Nothing
Set olItem = Nothing
Exit Sub
End Sub
Private Sub PrintFile(ByVal strPath As String)
Dim FSO As FileSystemObject
Dim oShell As Object
Dim Fldr As Object
Dim FldrItem As Object
Set FSO = New FileSystemObject
Set oShell = CreateObject("Shell.Application")
Set Fldr = oShell.NameSpace(0)
Set FldrItem = Fldr.ParseName(strPath)
FldrItem.InvokeVerbEx ("print")
lbl_Exit:
If Not FSO Is Nothing Then Set FSO = Nothing
If Not Fldr Is Nothing Then Set Fldr = Nothing
If Not FldrItem Is Nothing Then Set FldrItem = Nothing
If Not oShell Is Nothing Then Set oShell = Nothing
Exit Sub
End Sub