VBA macros accessing Acrobat DC Pro reference library stopped working

Community Beginner ,
Apr 19, 2022 Apr 19, 2022

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?

TOPICS
Windows

Views

650

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Apr 22, 2022 Apr 22, 2022

Also, check that Protected Mode is off (Preferences - General - Security (Enhanced))

Likes

Translate

Translate
Adobe Community Professional ,
Apr 20, 2022 Apr 20, 2022

Copy link to clipboard

Copied

Hi,

 

Can you post more of the code, particularly how you are cleaning up after you code has run?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 21, 2022 Apr 21, 2022

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

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 21, 2022 Apr 21, 2022

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"

 

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Apr 22, 2022 Apr 22, 2022

Copy link to clipboard

Copied

Hi,

 

Maybe I am missing something, but where does "varDayTime" get set?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 22, 2022 Apr 22, 2022

Copy link to clipboard

Copied

Also, check that Protected Mode is off (Preferences - General - Security (Enhanced))

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 27, 2022 Apr 27, 2022

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.

Adobe Integration Issue - ‎Jan 26 2022 09:44 AM

From within my Access app, I've been able to open, edit, save and close a pdf file using the Adobe Acrobat reference. The app had been running great for several months.  Recently, the VBA "Save" command no longer saves the pdf. .....................

.................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?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 27, 2022 Apr 27, 2022

Copy link to clipboard

Copied

Also from the above post:

Using two PCs, I tested several configurations and this is what I found:

  • Fully-updated (Microsoft) + Adobe Acrobat DC (installed 1/12/22): Doesn't work
  • Fully-updated (Microsoft) + Adobe Acrobat DC 2020: Works fine
  • Not-recently-updated (Microsoft) + Adobe Acrobat DC 2020: Works fine

As such, I'm of the opinion that the issue is with my latest version (2021.011.20039) of Adobe Acrobat DC.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 05, 2022 May 05, 2022

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".

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 05, 2022 May 05, 2022

Copy link to clipboard

Copied

Thanks for confirming. Protected mode is a major nuisance.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 08, 2022 Aug 08, 2022

Copy link to clipboard

Copied

LATEST

Thanks a lot for this comment. It worked perfectly for me! Problem solved.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines