This week's book giveaways are in the Refactoring and Agile forums. We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line! See this thread and this one for details.
Hello All, I am working on a project that will open Word Mail mail merge docs, and I need to open a specific file. I have a UI that let's the user choose a document with a button, and the action passes the path and file name to my class that I have written using Jacob.
I have import statements for com.jacob.activeX.ActiveXComponent;, and import com.jacob.com.*;
ActiveXComponent oWord = new ActiveXComponent("Word.Application"); oWord.setProperty("Visible", new Variant(true)); Object oDocuments = oWord.getProperty("Documents").toDispatch(); Object oDocument = Dispatch.call(oDocuments, "Open", myFileName);
The basic problem is, that I have an app working that opens MS Word, and inserts a line of text. (I used my file path/name to make sure it was getting there). But when I try to use the Dispatch class the compiler says it can't find the "class" call in Dispatch. I have also tried import statements like com.jacob.Dispatch.*; and com.jacob.Dispatch;
I have peeked inside the jacob jar file with winzip, and I can see the call method, and the nodes.
How do you get Jacob to point to a specific file? I am able to open Word with my app, and insert text, but I want to point to a specific file.