I've been trying to code a fairly uncomplicated program that will read some values from an Excel worksheet into Illustrator variables.
I tried VBA first, being careful to add the Illustrator Reference Library. I could swear that my first attempt (the usual "Hello World" thing from the Illustrator VB Reference Guide) was successful, but maybe I'm delusional. Anyway, I wish now I'd saved that code, because every attempt afterward generated a 403 error message on encountering the first "Set =" statement.
It didn't matter whether I was trying to create a new document, open an old one, or modify one that was already open; as soon as I tried to refer to the document in any way...
Runtime Error 403:
Class does not support Automation or does not support expected interface
I retyped the code eight ways from Sunday, and even tried it in VBExpress. Same result-- though I did get a fuller explanation, if one I'm powerless to decipher:
System.InvalidCastException: Unable to cast COM object of type 'Illustrator.ApplicationClass' to interface type 'Illustrator._Application'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{95CD20AA-AD72-11D3-B086-0010A4F5C335}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
The odd thing is that a VBScript version of the same code works fine. Unfortunately, I can't use VBScript for this project, as it lacks certain functions that I need to format my Excel data.
Any idea what the problem could be? Is it possible my Interop.Illustrator.dll file got damaged somehow? The Adobe Illustrator scripting forum turns up no one else who's run into this problem, though you'd think by now someone would have if it was a universal issue. (They can't ALL be using JavaScript!)
Any and all suggestions would be greatly appreciated. Thanks.