Hi everyone,
I want to export data from pdf to excel. Here is what I have searched from the internet but the code could not open the pdf file.
The pdf file did not open with the code: AcrobatApplication.Show and nothing transfer to excel
I want to export data from pdf to excel. Here is what I have searched from the internet but the code could not open the pdf file.
Rich (BB code):
Sub ReadAdobeFields()
row_number = 1
Dim AcrobatApplication As Acrobat.CAcroApp
Dim AcrobatDocument As Acrobat.CAcroAVDoc
Dim fcount As Long
Dim sFieldName As String
On Error Resume Next
Set AcrobatApplication = CreateObject("AcroExch.App")
Set AcrobatDocument = CreateObject("AcroExch.AVDoc")
If AcrobatDocument.Open("C:\Users\UserName\Documents\Audit\f1040.pdf", "") Then
AcrobatApplication.Show
Set AcroForm = CreateObject("AFormAut.App")
Set Fields = AcroForm.Fields
fcount = Fields.Count ' Number of fields
For Each field In Fields
row_number = row_number + 1
sFieldName = field.Name
'MsgBox sFieldName
Sheet1.Range("B" & row_number) = field.Name
Sheet1.Range("C" & row_number) = field.Value
Sheet1.Range("D" & row_number) = field.Style
Next field
Else
MsgBox "Failure"
End If
AcrobatApplication.Exit
Set AcrobatApplication = Nothing
Set AcrobatDocument = Nothing
Set field = Nothing
Set Fields = Nothing
Set AcroForm = Nothing
End Sub
The pdf file did not open with the code: AcrobatApplication.Show and nothing transfer to excel
Last edited by a moderator: