Copy link to clipboard
Copied
Hi!
I would like to use eval() from VBA using the jsobject, but I won't get the simplest eval("1+1") running because VBA stops with an error "Error 438: Object does not support method or property"
Any hints? Is the brigde supporting eval?
I have the feeling the brigde sort of knows .eval, because the 'e' becomes capitalized in the VBA Debugger.
Still if you look up the Acrobat documentation of the JavaScript brigde there is no entry regarding eval.
Using the string to eval with or without extra quotes in the string, does not make a difference.
All relevant references are set.
This is my code:
Sub Adobe_TypeHello_and_TryEval()
Dim gApp As Acrobat.CAcroApp
Dim gPDDoc As Acrobat.CAcroPDDoc
Dim jso As Object
Dim strFileName As String
Dim ReturnVal
Dim strEval As String
strFileName = "c:\Temp\MyFile.pdf"
' does not matter which definition to use, both fail
strEval = "1+1" 'string is 1+1
' strEval = """1+1""" 'string is "1+1"
Set gApp = CreateObject("AcroExch.App")
gApp.Show
Set gPDDoc = CreateObject("AcroExch.PDDoc")
If gPDDoc.Open(strFileName) Then
Set jso = gPDDoc.GetJSObject
jso.console.Show
jso.console.Clear
jso.console.println ("Hello World!")
'Code is working until here
ReturnVal = jso.Eval(strEval) ' <-- Debugger stops here with error.
End If
End Sub
Thanks, Helmut
evalI() is a core JS method that you can’t call directly from the bridge – you can only call Acrobat methods from the bridge.
Copy link to clipboard
Copied
evalI() is a core JS method that you can’t call directly from the bridge – you can only call Acrobat methods from the bridge.
Copy link to clipboard
Copied
I don't like the answer, but it looks like I have to accept it.
Have a nice Day!
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more