A vba script that I've used for years is suddenly stuck on an error I can't resolve. The code essentially points to a PDF and uses that PDF's bookmarks to create a Table of Contents in a word document.
I upgraded to Windows 10 from 7 and Adobe Pro DC from Adobe Pro 10 since the last time I ran it so I don't know which software is causing a problem. Here is the code :
Application.ScreenUpdating = False
Dim membCode(), a As Integer
membCode = Array("BH")
For a = 0 To UBound(membCode)
Application.ScreenUpdating = True
Private Sub BFormulaire_Click(fff)
Dim retour As Boolean
Dim PInt_Retour_X_pixel As Integer
Dim PInt_Retour_Y_Pixel As Integer
Dim AcroExchApp As Object, AcroPDFDoc As Object, AcrobatViewPage As Object, _
AcrobatPage As Object, AcrobatTaille As Object, acroform As Object, Champs As Object, _
field As Object, oneg As String, sJS3b As String, sJS4 As String, tr As String
Set AcroExchApp = CreateObject("AcroExch.App")
Set AcroPDFDoc = CreateObject("AcroExch.AVDoc")
retour = AcroPDFDoc.Open("a:\" & fff & "_test.pdf", "Title of window")
If Not retour Then
MsgBox "Pb oopen"
Set AcrobatViewPage = AcroPDFDoc.GetAVPageView
Set AcrobatPage = AcrobatViewPage.GetPage
Set AcrobatTaille = AcrobatPage.GetSize
PInt_Retour_X_pixel = AcrobatTaille.x
PInt_Retour_Y_Pixel = AcrobatTaille.y
Set AcrobatTaille = Nothing
Set acroform = CreateObject("AFormAut.App")
Set Champs = acroform.Fields
Set field = Champs.Add("Plan", "button", 0, 10, PInt_Retour_Y_Pixel - 10, 70, PInt_Retour_Y_Pixel - 50)
field.Value = "consultation du plan"
field.ButtonLayout = 1
field.Highlight = "none"
field.PrintFlag = False
oneg = "MouseUp"
The program errors on the line : "Set Champs = acroform.Fields" with the error:
Run time error :2147319765 (8002802b)
Automation error Element Not Found.
I activated the adobe references in Word: AFormAut 1.0 Type Library and Adobe Acrobat 10.0 Type Library. Didnt change anything. Anyone have any thoughts? Attached is a sample pdf just for testing.
Thanks for your help,
I have the same problem - do you have a solution?
Thanks for your help,
[Question moved to the Acrobat SDK forum]
I also have a similar sitution where scripts stopped working, did you find a solution?
Copy link to clipboard
I just had this same issue. I fixed it by going into Adobe Acrobat and selecting
Edit > Preferences > Security (Enhanced)
And then deselecting the box at the top labelled "Enable Protected Mode as Startup (Preview)"
This was my solution as well. Thanks for your help!