Macro to print PDF and delete in Outlook 2016

0

I'm working on a macro to print all emails received in PDF but it's not working, I do not know if it's the version of my adobe that is the latest one.

Does anyone have any ideas?

This script

Public Sub PrintAttachments()
Dim Inbox As MAPIFolder
Dim Item As MailItem
Dim Atmt As Attachment
Dim FileName As String
Dim i As Integer

Set Inbox = GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Folders.Item("Batch Prints")  

For Each Item In Inbox.Items
    For Each Atmt In Item.Attachments
        ' all attachments are first saved in the temp folder C:\Temp.  Be sure to create this folder.
        FileName = "C:\Users\cajuv\Desktop\pdf" & Atmt.FileName
        Atmt.SaveAsFile FileName
        ' please change the program folder accordingly if the Acrobat Reader is not installed on drive C:
        Shell """C:\Program Files (x86)\Adobe\Acrobat 10.0\Acrobat\Acrobat.exe"" /h /p """ + FileName + """", vbHide
    Next

    Item.Delete  'remove this line if you don't want the email to be deleted automatically
Next

Set Inbox = Nothing
End Sub
    
asked by anonymous 04.12.2018 / 17:19

0 answers