I wrote a few VBA macros in Excel and Outlook that access the Acrobat Reference Library, our office currently uses Office 2016 and Acrobat DC Pro 21.011.200393.0.
About a dozen users have been using these macros for years without issue. However, this year they began to stop running for users either after a uninstall/reinstall of Acrobat DC Pro *OR* after a software/system update (not sure if these updates included Acrobat).
I have had Acobat DC Pro uninstalled/reinstalled for three different users and after the reinstall Outlook macros will run ONCE and Excel macros will run ONCE and they will not run again. For example, I just had an Acrobat DC Pro uninstall/reinstall done on my computer and ran an Outlook macro that looped through and correctly processed hundreds of PDF files. Then, when I tried to run it a second time I got the error below. If I do some testing with pared down code (including trying early and late binding) I get erratic results and various errors and even some (very) limited success. However, the primary error is that the macros cannot access the Acrobat Reference Library as shown below:
Dim AcroApp As Acrobat.CAcroApp Set AcroApp = CreateObject("AcroExch.App") ‘ Error Here >> Run Time Error -2146959355 (80080005), Server Exection Failed <<
Any suggestions on what is wrong & how to fix?
Copy link to clipboard
Can you post more of the code, particularly how you are cleaning up after you code has run?
The code below is in Outlook. As I mentioned, after an Acrobat uninstall/reinstall this code processed a few hundred PDFs but then would not run again. FYI, excel macros do not use the JS object and save active PDFs one at a time when user clicks a button.
Sub SRRI_TestPDF(newSaveTempFullPath As String) 'Open the PDF, create Text File and write PDF to it Dim AcroXApp As Acrobat.AcroApp Dim AcroXAVDoc As Acrobat.AcroAVDoc Dim AcroXPDDoc As Acrobat.AcroPDDoc Dim jsObj As Object Dim PDFfullPath As String Dim TextFullPath As String PDFfullPath = newSaveTempFullPath TextFullPath = TempFolder & "SRRI_txtFile" & varDayTime & ".txt" ''''Set AcroXApp = CreateObject("AcroExch.App") '2019 - Changed to NEW due to errors Set AcroXApp = New AcroApp Set AcroXAVDoc = CreateObject("AcroExch.AVDoc") AcroXAVDoc.Open PDFfullPath, "Acrobat" AcroXApp.Hide Set AcroXPDDoc = AcroXAVDoc.GetPDDoc Set jsObj = AcroXPDDoc.GetJSObject jsObj.SaveAs TextFullPath, "com.adobe.acrobat.plain-text" 'Create & write to text file 'MARCH 2022 ===================== AcroXApp.CloseAllDocs AcroXApp.Exit Set jsObj = Nothing Set AcroXPDDoc = Nothing Set AcroXAVDoc = Nothing Set AcroXApp = Nothing Call AllTextExtract(TextFullPath) 'Call to extract info from txt file End Sub
Doing some more testing, now code is able to access Acrobat app but error is on line below, get a Adobe Pop Up "File Open Failed".
jsObj.SaveAs TextFullPath, "com.adobe.acrobat.plain-text"
Maybe I am missing something, but where does "varDayTime" get set?
Also, check that Protected Mode is off (Preferences - General - Security (Enhanced))
Re. The above comments, protected mode is off and variable comes from prior sub - its working OK.
I found the post below on a Microsoft site, it indicates there may be an integration problem with VBA and a recent Acrobat version. I've had problems similar to those in the post as on the rare occasions when I can access the Acrobat library, my code will not save on this: boolSaved = PdDoc.Save(PDSaveFull, PdfNewPath). It does not throw an erorr, it just doesn't save.
.................After first telling me I needed to upgrade to an Enterprise License (wrong) followed by "it's impossible to roll-back to my previous version" (wrong), I received an email today from Adobe with excellent instructions on rolling-back to my previous version. As expected, all good now.
Getting the Acrobat version rolled back may be an issue for me so I want to try to search out other fixes first. Any comments on integration issues with recent Acrobat versions and MS Office/VBA or other possibilities?
Also from the above post:
Using two PCs, I tested several configurations and this is what I found:
As such, I'm of the opinion that the issue is with my latest version (2021.011.20039) of Adobe Acrobat DC.
For the record, this issue has been resolved as follows: Edit > Preferences > Security (Enhanced) > ** UNCHECK ** check box "Enable Protected Mode at startup (Preview)" > exit all PDFs.
Thanks to Test Screen Name who said "Protected Mode" needs to be off, unchecking box as above apparently does that. I had incorrectly been looking at "Protected View".
Thanks for confirming. Protected mode is a major nuisance.
Thanks a lot for this comment. It worked perfectly for me! Problem solved.