kit_sune
New member
- Joined
- Jan 14, 2014
- Messages
- 6
- Reaction score
- 0
- Points
- 0
- Excel Version(s)
- 2010
I was wondering if there was a way to list out the names of the fields within a pdf form. In my office we are required to retain a specific form for up to a year. We review these forms on a quarterly basis to verify the users of our database. It's a tedious process. We don't know the names of any of the fields however. Eventually I would like to iterate through all the pdf files in a folder (something I'm already doing to list the names of the files). My first focus is to get the names of the fields from the pdf so I can actually work with them. I pulled (and modified) the code below from another website while trying to figure out if this is possible.
I had to enable the Adobe Arobat 10.0 Type library. I know there are errors in the code below but I wanted to illustrate what the goal is. When I run it, it tells me "Object required"
Thank you for your time.
~Kit
I had to enable the Adobe Arobat 10.0 Type library. I know there are errors in the code below but I wanted to illustrate what the goal is. When I run it, it tells me "Object required"
Code:
Private Sub ListPDFFieldNames()
Dim AcroApp As Acrobat.CAcroApp
Dim theForm As Acrobat.CAcroPDDoc
Dim jso As Object
Dim rowNum As Integer
Set AcroApp = CreateObject("AcroExch.App")
Set theForm = CreateObject("AcroExch.PDDoc")
theForm.Open ("C:\Users\me\Documents\sampleForm.pdf")
Set jso = theForm.GetJSObject
rowNum = 1
For Each field In jso
Range("A" & rowNum) = field.Name
rowNum = rowNum + 1
Next field
theForm.Close
AcroApp.Exit
Set AcroApp = Nothing
Set theForm = Nothing
MsgBox "Done"
End Sub
Thank you for your time.
~Kit