I apologize if this would be better suited for another forum on this board, but I cannot find one for non-core API's.
My problem is with the JACOB (Java-COM Bridge) API. If anyone has experience with this, your input would be greatly appreciated.
Here is my code:
377 ActiveXComponent wordComponent = new ActiveXComponent (
378 "Word.Application");
379 Dispatch wordObject = wordComponent.getObject();
380 wordComponent.setProperty("Visible", new Variant (true));
381 Dispatch documents = Dispatch.get(wordObject,
382 "Documents").toDispatch();
383 Dispatch document = Dispatch.call(documents,
384 "add", envelopeFile).toDispatch();
385 Dispatch.call(document, "Activate");
386 Dispatch activeDocument = Dispatch.get(wordObject,
387 "ActiveDocument").toDispatch();
On line 384 I get the error:
com.jacob.com.ComFailException: VariantChangeType failed
When I try to break the line into multiple, independent commands, I get the same error on the last line of the following:
Variant document1 = Dispatch.call(documents,
"add", envelopeFile);
Dispatch document = document1.toDispatch();
For some reason, it can't change the type from Variant to Dispatch. This all works perfectly fine for me using the Eclipse IDE, but when I export it to a JAR, sign it, and use it in an HTML page, I get this error. Any advice? Thanks!