Adobe no longer supports Acrobat 9.
However make sure you that you have Acrobat Professional (or Standard) installed and not just Reader.
I have Acrobat 9 Standard installed
Do you also have Acrobat Reader installed (Any version)?
Yes I did have reader but i uninstalled - did not fix the problem
Try a REPAIR on Acrobat now. if not enough, try having Acrobat already running when using your code. If that still doesn’t help please tell us your code and error.
Here is error msg. with Acrobat running
And complete code attached
Please don’t try to email screen shots, we do not see them. You can come to the forum and post them or type out the text.
fair enough Acrobat is running and still get this error
after error I quit program it closes the Acrobat window that was open
error is now from different line when Acrobat is open
took out bOK now error is at
And code does open my form and ion screen at this point
OK running as admin no errors with code now but but for each formfield loop doesn't see any fields
OK did post in forum new at this
A zillion googles later I have it working
To save somebody else some time, can you please share what you found.
first fix activex error - this line fixed that
then to try and figure out I commentd out this line AcroExchApp.Hide()
so here is complete and working code
' want to add temp table
Dim nRowCounter As Integer
'Create the table
Dim Table1 As DataTable
Table1 = New DataTable
'Add columns to it
'Add rows and fill with data
Dim EditRow As DataRow
Dim AcroExchAVDoc As CAcroAVDoc
Dim AcroExchApp As CAcroApp
Dim AFORMAUT As AFORMAUTLib.AFormApp
Dim FormField As AFORMAUTLib.Field
Dim FormFields As AFORMAUTLib.Fields
Dim bOK As Boolean
Dim sFields As String
Dim sTypes As String
Dim sFieldName As String
Dim mycount As Integer
' For this procedure to work, computer must have a full version
' of Adobe Acrobat installed. Also, a reference to the following
' Type Libraries must be made:
' AFormAut 1.0
' Adobe Acrobat 7.0 (or newer)
On Error GoTo ErrorHandler
AcroExchApp = CreateObject("AcroExch.App")
AcroExchAVDoc = CreateObject("AcroExch.AVDoc")
'bOK = AcroExchAVDoc.Open(ActiveWorkbook.Path & "\" & PDF_FILE, "")
'bOK = AcroExchAVDoc.Open("C:\PCode2017\PDFinfo\testform.pdf", "")
'I have since found that to get the field lists in Acrobat 9 then
' AcroExchAVDOC.BringToFront and AcroExchApp.Hide need to be used.
' As without these the Acrobat object thinks there is no form loaded.
sFields = ""
sTypes = ""
bOK = True
If (bOK) Then
'AFORMAUT = CreateObject("AFORMAUT.App")
' now no activex error
AFORMAUT = New AFORMAUTLib.AFormApp
FormFields = AFORMAUT.Fields
'FormFields = New AFORMAUTLib.Fields
mycount = FormFields.Count
For Each FormField In FormFields
sFieldName = .Name
nRowCounter = nRowCounter + 1
EditRow = Table1.NewRow()
EditRow(0) = nRowCounter
EditRow(1) = .Name
EditRow(2) = .Type
If .IsTerminal Then
If sFields = "" Then
sFields = .Name
sTypes = .Type
sFields = sFields + "," + .Name
sTypes = sTypes + "," + .Type
'Create a dataset and add this table to it
Dim DS As DataSet
DS = New DataSet
Me.DataGridView1.DataSource = DS.Tables("table1")
AcroExchAVDoc = Nothing
AcroExchApp = Nothing
AFORMAUT = Nothing
'Field = Nothing
MsgBox("FieldList Error: " + Str(Err.Number) + " " + Err.Description + " " + Err.Source)
works great - now on to creating code to fill the form
You need a reference to the correct type library. See here for more information: Where can I get the AFormAutLib.dll?
Then, you need to fix your code, it seems you are mixing up the parameters for Dim and CreateObject:
- Dim AFORMAUT As AFORMAUTLib.AFormApp
- Set AFORMAUT = CreateObject("AFormAut.App")
can't use set -if I typr that in VS2005 it deletes it