Search code examples
vbaexcelfoxit

How to open a second PDF in the same instance of Foxit?


I want to use Excel to open two PDFs in Foxit PhantomPDF, so that they open as tabs in the same instance of Foxit. I have set Foxit as my default PDF viewer, and I'm running the following VBA:

ActiveWorkbook.FollowHyperlink Address:="T:\PDFs\doc1.pdf", NewWindow:=False
ActiveWorkbook.FollowHyperlink Address:="T:\PDFs\doc2.pdf", NewWindow:=False

However, this opens two Foxit windows, each with a single tab, where one has doc1.pdf and the other has doc2.pdf. How can I make sure that they will both open in the same instance?


Solution

  • I was able to accomplish this by replacing the FollowHyperlink with a Shell call as follows:

    Shell """C:\Program Files (x86)\Foxit Software\Foxit PhantomPDF\Foxit PhantomPDF.exe"" " & _
          """T:\PDFs\doc1.pdf"""
    Shell """C:\Program Files (x86)\Foxit Software\Foxit PhantomPDF\Foxit PhantomPDF.exe"" " & _
          """T:\PDFs\doc2.pdf"""