I was reading from a forum thread: https://forums.adobe.com/thread/604177 and started experimenting with it. But I think the function didn't load at all. I wasn't sure what might the reason be behind it - I reckon it has to be simple and probably related to the library. Can someone help point out why the following code failed to compile at all (the code appeared not to have ran upon execution in immediate as none of the breakpoints triggered).
The libraries I have loaded include
The computer which this code is executed on have Acrobat Professional installed on it.
Public Function GetPDF() '(FilePath As String) As Object
Dim origPdf As Acrobat.AcroPDDoc
Dim path1 As String
MsgBox ("Start")
path1 = Application.ActiveWorkbook.Path
path1 = path1 & "\31700100.pdf"
Set origPdf = CreateObject("AcroExch.PDDoc")
If origPdf.Open(path1) Then
MsgBox ("weee")
End If
origPdf.Close
Set origPdf = Nothing
End Function
Opening documents in VBA will require you to have an Acrobat App object. The code will work once you have an app object in the function.
Public Function GetPDF (FilePath As String) As Object
Dim ArcoApp As New Acrobat.AcroApp
Dim OriPdf As New Acrobat.AcroPDDoc
Set ArcoApp = CreateObject("AcroExch.App")
Set OriPdf = CreateObject("AcroExch.PDDoc")
If OriPdf.Open(FilePath) Then
MsgBox ("weee")
End If
GetPDF = OriPdf
OriPdf.Close
AcroApp.Close
Set OriPdf = Nothing
Set AcroApp = Nothing
End Function