Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GetJSObject fails when run on Microsoft Surface (Excel-VBA)

I have written a small utility in Excel-VBA that also interacts with Acrobat Javascript in a handful of separate .pdf files.

The code has been tested extensively and runs exactly as intended on my desktop PC. However, I ultimately need to implement this code on a Microsoft Surface platform. When I try to run the same code from an Excel file on a Microsoft Surface, the code balks at any lines utilizing "GetJSObject."

Eg. The following works fine on my PC, but causes an "object or method not supported" error on my Surface.

Set gAPP = CreateObject("AcroExch.App")

Set gPDDOC = CreateObject("AcroExch.PDDoc")

If gPDDoc.Open(pdfFileName) Then Set jso = gPDDOC.GetJSObject

So far, I've been able to find some hints online that GetJSObject doesnt work well in a 64 bit environment and my Surface runs 64 bit Windows 10 and 32 bit Excel.

However, I don't think that this alone can account for the difference in behavior across both machines; my desktop is running 64-bit Windows 7 with 32 bit Excel, and everything works as intended.

Where should I be looking to help discover the source (and solution) of the problem?

EDIT/UPDATE: The getJSObject statement actually works as intended, IF I take the additional step of manually opening a copy of one of the relevant .pdf files in Acrobat prior to running my VBA code. I assume this means that it is somehow the object definitions (e.g. Set gAPP = CreateObject("AcroExch.App")) that are working differently on the Surface relative to my PC--and not the getJSObject command specifically, as originally thought?

So far, it hasnt made much sense to me how/why this could be true (let alone how I could go about resolving the issue).

like image 512
John Q. Noob Avatar asked Mar 21 '16 21:03

John Q. Noob


1 Answers

Not sure if this had been answered yet, however there are two courses of action i'd take for research:

1.

See if you can launch it without the constructor by using:

Set AcroApp = New AcroApp

Rather than

Set AcroApp = CreateObject("AcroExch.App")

2.

Ensure you are using the same version of acrobat, from my research this error occurs from the very first result in Google for the search query:

createobject acroexch.app error 429
You cannot do this with Adobe Reader, you need Adobe Acrobat.

This OLE interface is available with Adobe Acrobat, not Adobe Reader.

like image 173
Realitybites Avatar answered Sep 18 '22 17:09

Realitybites