Skip to main content
Mycological
Participant
May 3, 2019
Answered

Using Excel VBA, how can I determine the pdf files that are opened in the user's session?

  • May 3, 2019
  • 2 replies
  • 1911 views

If I were writing this to find opened word documents the code would be

Set wdApp = GetObject(, "Word.Application")

This gives me the number of open word documents.

How can I do the same for pdf files?

This topic has been closed for replies.
Correct answer Mycological

I will go to Acrobat SDK in the future.

The answer is was looking for is below, it works well. Thanks

        Dim pdApp As Acrobat.AcroApp

        Dim pdDoc As Acrobat.AcroPDDoc

        Dim numPDF As Integer

Set pdApp = CreateObject("AcroExch.App")

Set pdDoc = CreateObject("AcroExch.PDDoc")

numPDF = pdApp.GetNumAVDocs

MsgBox (numPDF)

2 replies

Mycological
MycologicalAuthorCorrect answer
Participant
May 6, 2019

I will go to Acrobat SDK in the future.

The answer is was looking for is below, it works well. Thanks

        Dim pdApp As Acrobat.AcroApp

        Dim pdDoc As Acrobat.AcroPDDoc

        Dim numPDF As Integer

Set pdApp = CreateObject("AcroExch.App")

Set pdDoc = CreateObject("AcroExch.PDDoc")

numPDF = pdApp.GetNumAVDocs

MsgBox (numPDF)

try67
Community Expert
Community Expert
May 5, 2019

Via the JavaScript object, run this code:

app.activeDocs.length

PS. In the future you'll be better off to ask questions about Acrobat in one of the Acrobat forums, like this one: Acrobat SDK