Hi all,
I have found a code that opens up a single pdf document and then from there I can save it as a txt file then open it and copy the text into excel. But I want to do it to multiple pdf files that are in the same folder - this part I'm having a problem with. So once it saves it as a text file open the first one up copy the data in column A, then loop to the next pdf save it as the same text file name that's ok then paste the data in column B.
Any help would be much appreciated.
Code below:
Dim AcroXApp As Object
Dim AcroXAVDoc As Object
Dim AcroXPDDoc As Object
Set AcroXApp = CreateObject("AcroExch.App")
AcroXApp.Hide
Set AcroXAVDoc = CreateObject("AcroExch.AVDoc")
AcroXAVDoc.Open "C:\PDF test\blah.pdf", "Acrobat"
AcroXAVDoc.BringToFront
Set AcroXPDDoc = AcroXAVDoc.GetPDDoc
Dim jsObj As Object
Set jsObj = AcroXPDDoc.GetJSObject
jsObj.SaveAs "C:\PDF test\test.txt", "com.adobe.acrobat.accesstext"
AcroXAVDoc.Close False
AcroXApp.Hide
AcroXApp.Exit
Dim Text
Dim i As Long
Worksheets("sheet2").Activate
Application.ScreenUpdating = False
'put your own path below
Open ActiveWorkbook.Path & "\test.txt" For Input As #1
i = 1
Do While Not EOF(1) ' Loop until end of file.
Input #1, Text
Range("a" & i) = Text
i = i + 1
Loop
Close #1
Bookmarks