I am trying to Convert PDF Data into Excel, for which I have basic subscription of Adobe Acrobat Reader which converts pdf to Excel. My issue begins when I start to code in VBA for extraction of data Since I have Adobe acrobat reader, adobe acrobat 10.0 Type library is not available with with, after a little research I found SDK Information and downloaded Library File from adobe site, unfortunately I only found 8.0 Type library because of which I got "ActiveX component can't create object (Error 429)"
I did some Finding on StackOverflow, but the ultimate solution is still not clear to me.
I am Not much familiar with Adobe library use in VBA, so I am unable to make changes in my coding. I am looking for adobe acrobat 10.0 Type library or some solution to Error 429 or any other Method where my VBA don't need Adobe acrobat library
Any Help or suggestion are appreciated. Thank you
So far I tried following Codes :
1)First attempt
Sub ConvertPDFtoXLS()
'declare variable
Dim avDoc As CAcroAVDoc
Dim pdDoc As CAcroPDDoc
Dim jsObj As Object
Dim pageNum As Integer
Dim outputFileName As String
'Set the path and filename of the PDF to convert
inputFilePath = "E:\File.pdf"
'Set the output filename and path for the XLS file
outputFileName = "E:\File.xlsx"
'Create the Acrobat objects`
Set avDoc = CreateObject("AcroExch.AVDoc")
Set pdDoc = CreateObject("AcroExch.PDDoc")
'Open the PDF document
If avDoc.Open(inputFilePath, "") Then
Set pdDoc = avDoc.GetPDDoc()
Set jsObj = pdDoc.GetJSObject()
'Convert the PDF to XLS format
jsObj.SaveAs outputFileName, "com.adobe.acrobat.xls"
'Close the PDF document
pdDoc.Close`
End If
'Close the Acrobat objects
Set jsObj = Nothing
Set pdDoc = Nothing
Set avDoc = Nothing
End sub
2) Partial Code
Sub OpenPdF(FilePath As String, Extension As String)
Dim objAcroApp As Acrobat.AcroApp
Dim objAcroAVDoc As Acrobat.AcroAVDoc
Dim objAcroPDDoc As Acrobat.AcroPDDoc
Dim objJSO As Object
Dim boResult As Boolean
Dim ExportFormat As String
Dim Newfilepath As String
Dim FileToOpen As String
Dim FileToExport As String
With Application
.StatusBar = "WAIT"
.ScreenUpdating = False
.DisplayAlerts = False
End With
Set objAcroApp = CreateObject("AcroExch.App")
ChDir FilePath
'select specific PDF file
FileToOpen = Application.GetOpenFilename("PDF Files, .pdf,", _
l, "Technician Technical Information - Select folder and file to open ", , False)
If TypeName(FileToOpen) = "" Then Exit Sub ' the user didn't select a file
'Set AVDoc object.
Set objAcroAVDoc = CreateObject("AcroExch.AVDoc") '**<<------ i am stuck here**
'Open the PDF file.
boResult = objAcroAVDoc.Open(FileToOpen, "")
'Set the PDDoc object.
Set objAcroPDDoc = objAcroAVDoc.GetPDDoc
'Set the JS Object - Java Script Object. Set objJSO = objAcr:oPDDoc.GetJSObject
End Sub