Skip to main content
Participating Frequently
April 20, 2022
Answered

VBA macros accessing Acrobat DC Pro reference library stopped working

  • April 20, 2022
  • 1 reply
  • 23713 views

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?

Correct answer Test Screen Name

Hi,

 

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


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

1 reply

BarlaeDC
Participating Frequently
April 20, 2022

Hi,

 

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

B CrossAuthor
Participating Frequently
April 22, 2022

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

 

New Participant
August 8, 2022

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 a lot for this comment. It worked perfectly for me! Problem solved.