0

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?

Community
  • 1
  • 1
sigil
  • 9,370
  • 40
  • 119
  • 199
  • 1
    Acrobat has an object model just like excel. It has open and openinwindow as part of the acroavdoc (and acropddoc). Press f2 in VBA editor, add adobe acrobat, then view it's methods. – D.Ddgg Jul 18 '14 at 00:30
  • @D.Ddgg, thanks, but I'm using Foxit, not Acrobat. – sigil Jul 22 '14 at 20:19

2 Answers2

1

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"""
sigil
  • 9,370
  • 40
  • 119
  • 199
0

You can try opening Preferences in your PhantomPDF installation and uncheck "Allow multiple instances" under Documents.

Brian Duddy
  • 343
  • 1
  • 11