Copy link to clipboard
Copied
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?
Also, check that Protected Mode is off (Preferences - General - Security (Enhanced))
Copy link to clipboard
Copied
Hi,
Can you post more of the code, particularly how you are cleaning up after you code has run?
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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"
Copy link to clipboard
Copied
Hi,
Maybe I am missing something, but where does "varDayTime" get set?
Copy link to clipboard
Copied
Also, check that Protected Mode is off (Preferences - General - Security (Enhanced))
Copy link to clipboard
Copied
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.
https://techcommunity.microsoft.com/t5/access/adobe-integration-issue/m-p/3072853
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?
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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".
Copy link to clipboard
Copied
Thanks for confirming. Protected mode is a major nuisance.
Copy link to clipboard
Copied
Thanks a lot for this comment. It worked perfectly for me! Problem solved.
Copy link to clipboard
Copied
Thanks B Cross - this resolved my issue too.
Copy link to clipboard
Copied
B Cross,
If you recall, do you know if the computer need a restart after you ** UNCHECK **, or does the macro work right after changing that setting.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Thanks @Test Screen Name for the solution. I was having this problem with a c# dll I have written to rename bookmarks.
BTW just closing Acrobat is not enough, at least on Windows 10, as it leaves an instance running. You have to use Task Manager to end it before the settings take effect.
Jon
Copy link to clipboard
Copied
I was having a problem where, other users who tried to run my VBA program on their computer ...... The .pdf (Acrobat API) would not combine the files. Worked fine on my machine but failed every single time on anybody else's. I have been struggling to find an answer to this issue for longer than a year - It effectively rendered my program ineffective and useless, to anybody else. Today I happened to stumble on this post .... and I wasn't even searching for it. I was working on another problem when this just popped up out of nowhere !! - I Unchecked "Protected View" on the other users' computer, ran the program ... and it worked flawlessly !! - I cannot tell you the sense of RELIEF when it worked. Thank you guys SO MUCH for posting this fix !! - Cheers