• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problems with Jacob Dispatch Class

 
Steve Stanicki
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.*;

The problem is I have an example from www.land-of-kain.de/jacob/ for doing this with the following lines:

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.

Any input would be appreciated.

Thanks,
Steve
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic