Search code examples
excelvba

Print 2 external PDF files while working on excel sheet


While working on excel worksheet, I need to print 2 different external PDF files in the same folder for my clients to sign.

Here are the files paths "D:\Templates to Print\Acknowledgment.pdf" and "D:\Templates to Print\Works Permit.pdf"

I have found this code while searching through internet but unfortunately not working

sub print_file()

Print_and_Close_PDF "D:\Templates to Print\Acknowledgment.pdf"
End sub`


Solution

  • As an alternative;

    Sub Test()
        Dim file1 As String, file2 As String
        
        file1 = "D:\Templates to Print\Acknowledgment.pdf"
        file2 = "D:\Templates to Print\Works Permit.pdf"
        
        CreateObject("Shell.Application").Namespace(0).ParseName(file1).InvokeVerb ("Print")
        CreateObject("Shell.Application").Namespace(0).ParseName(file2).InvokeVerb ("Print")
    End Sub