Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

417
Views
jso.numfields not returning anything within Excel VBA while connecting to PDF file

So I am trying to write a VBA Macro in Excel that will loop through all 400+ .pdf files I have in a folder, extract pertinent data from them, and store that data in an Excel spreadsheet. However I am not sure that my .pdf files are even being opened. My file path is good, but when I try to detect any fields in the .pdf file using .numfields, it returns 0. I've checked Adobe Acrobat in my References tool, are there any 'things' I need to set up for JS Objects to work in Excel VBA ?

Here is my code so far:

Private Sub CoH_Water_Invoice()

     'Declare the File Path
     Dim path As String: path = "K:\Administration\Utilities\FY22\"
     Dim file As String: file = Dir(path & "*.pdf")

     'Set up Variables/Acrobat Objects
     Dim AcroApp As Acrobat.CAcroApp
     Dim theForm As Acrobat.CAcroPDDoc
     Dim jso As Object

     Set AcroApp = CreateObject("AcroExch.App")
     Set theForm = CreateObject("AcroExch.PDDoc")
     theForm.Open(path & file)
     Set jso = theForm.GetJSObject

     'Check for fields
     If jso.numfields > 0 Then
          Debug.Print("Fields detected")
     Else
          Debug.Print("No Fields detected")
     End If

     theForm.Close
     AcroApp.Exit
     Set AcroApp = Nothing
     Set theForm = Nothing
End Sub

In the "Immediates" window, I always get "No Fields detected", so it is not picking up any fields in the JS Object. Any ideas?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!