Criei um código para imprimir todos os anexos que receber mesmo que estes cheguem compactados. O modo como escolhi fazer isso envolve salvar o arquivo zipado para um local temporário e descompactá-lo de lá.
Manipulando Impressoras e Impressões:
Mas isso não funciona tão bem, o problema é que ao salvar o arquivo zipado, recebo automaticamente um alerta do explorer perguntando se quero descompactá-lo.
Para evitar este pop-up precisei renomear o arquivo como .TXT, saldo-o assim e em seguida, após tê-lo salvo, renomeá-lo novamente para .ZIP.
Dim Item As Outlook.MailItem
Dim unzipedFile As String
Dim searchString As String
Dim FileNameFolder As Variant
Set ns = GetNamespace("MAPI")
Let myMailBox = "Mailbox - AD"
Let searchString = ".zip"
Select Case ns.GetDefaultFolder(olFolderInbox).Parent
Set MyInbox = ns.Folders(myMailBox).Folders("Inbox").Items
Set PrintMailBox = ns.Folders("Mailbox - PRINT").Folders("Inbox").Items
Set Inbox = ns.Folders("Mailbox - PRINT").Folders("Inbox")
Set Done = Inbox.Folders("Printed")
Set PrintMailBox = ns.Folders("Mailbox - PRINT").Folders("Inbox").Items
Set Inbox = ns.Folders("Mailbox - PRINT").Folders("Inbox")
Set Done = Inbox.Folders("Printed")
If PrintMailBox.Count > 0 Then
For Each Item In PrintMailBox
If Item.Attachments.Count > 0 Then
For Each Atmt In Item.Attachments
If Right(Atmt.FileName, 3) = "zip" Then
'FileNameFolder = "C:\Temp\"
'FileName = FileNameFolder & Atmt.FileName
'Atmt.SaveAsFile FileName 'THIS IS WHERE THE POP UP OCCURS
'Set oApp = CreateObject("Shell.Application")
'oApp.NameSpace((FileNameFolder)).CopyHere oApp.NameSpace((FileName)).Items
Let FileNameFolder = "C:\Temp\"
Let FileName = FileNameFolder & Left(Atmt.FileName, (InStr(1, Atmt.FileName, ".zip") - 1)) & ".txt"
Atmt.SaveAsFile FileName 'copy the file to the folder
Let FileNameT = FileNameFolder & Atmt.FileName
Name FileName As FileNameT
Set oApp = CreateObject("Shell.Application")
oApp.NameSpace((FileNameFolder)).CopyHere oApp.NameSpace((FileNameT)).Items
Set FSO = CreateObject("scripting.filesystemobject")
FSO.deletefolder Environ("Temp") & "\Temporary Directory*", True
Let atmtName = Atmt.FileName
Let unzipedFile = Left(atmtName, (InStr(1, atmtName, searchString) - 1))
Select Case Right(unzipedFile, 3)
Let FileName = Left(unzipedFile, (InStr(1, unzipedFile, "-doc") - 1))
Let FileName = "C:\Temp\" & FileName & ".doc"
ShellExecute 0, "print", FileName, vbNullString, vbNullString, 0
Let FileName = Left(unzipedFile, (InStr(1, unzipedFile, "-docx") - 1))
Let FileName = "C:\Temp\" & FileName & ".docx"
ShellExecute 0, "print", FileName, vbNullString, vbNullString, 0
Let FileName = Left(unzipedFile, (InStr(1, unzipedFile, "-xls") - 1))
Let FileName = "C:\Temp\" & FileName & ".xls"
ShellExecute 0, "print", FileName, vbNullString, vbNullString, 0
Let FileName = Left(unzipedFile, (InStr(1, unzipedFile, "-xlsx") - 1))
Let FileName = "C:\Temp\" & FileName & ".xlsx"
ShellExecute 0, "print", FileName, vbNullString, vbNullString, 0
Let FileName = Left(unzipedFile, (InStr(1, unzipedFile, "-ppt") - 1))
Let FileName = "C:\Temp\" & FileName & ".ppt"
ShellExecute 0, "print", FileName, vbNullString, vbNullString, 0
Let FileName = Left(unzipedFile, (InStr(1, unzipedFile, "-pps") - 1))
Let FileName = "C:\Temp\" & FileName & ".pps"
ShellExecute 0, "print", FileName, vbNullString, vbNullString, 0
Let FileName = Left(unzipedFile, (InStr(1, unzipedFile, "-pptx") - 1))
Let FileName = "C:\Temp\" & FileName & ".pptx"
ShellExecute 0, "print", FileName, vbNullString, vbNullString, 0
Let FileName = Left(unzipedFile, (InStr(1, unzipedFile, "-pdf") - 1))
Let FileName = "C:\Temp\" & FileName & ".pdf"
ShellExecute 0, "print", FileName, vbNullString, vbNullString, 0
Let FileName = "C:\Temp\" & Atmt.FileName
ShellExecute 0, "print", FileName, vbNullString, vbNullString, 0
Do Until currentTime + TimeValue("00:00:30") <= Now