• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User


  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Error Converting PDF to Excel using VBA


New Member
re previous post containing code: https://chandoo.org/forum/threads/vba-to-convert-pdf-to-txt.14245/#post-281389

I've tested the code from the above post and my PDF file opens but when the code gets to the line:
"jsObj.SaveAs NewFileName, "com.adobe.acrobat.plain-text" it freezes and the acrobat file is open in acrobat with a dialog box that says:
"File Open Failed"

My variables are as below

Filename = "C:\Users\Richard\Documents\Excel\PDFs_to_Convert\Universal Stmt Aug.pdf"
NewFileName = "C:\Users\Richard\Documents\Excel\PDFs_Converted_to_Xlsx\Universal Stmt Aug.txt"

In Tools References I do have the Acrobat 10.0 Library selected

I have checked my Acrobat settings for Trusted locations, etc and have included my saveAs location in those settings
Any suggestions as to why I'm getting this error



Well-Known Member
If your are using O365, then you have Get & Transform Data on the Data Tab. With this, you can import PDF directly into the Power Query Editor and then close and load to native Excel. No code required. Quick and simple.


New Member
Alan, Thanks, but I need to do this from within Excel using VBA.

I can close this discussion because I found that the solution was a registry change for Acrobat
Computer\HKEY_CURRENT_USER\SOFTWARE\Adobe\Adobe Acrobat\DC\Privileged changed the key bProtectedMode from 1 to 0

Now no errors!