Get the tools you need to learn Java skills fast!
Video tutorials, eBooks, hands-on lab exercises, sample code.
Get started
The moose likes Other JSE/JEE APIs and the fly likes Problems with Jacob Dispatch Class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Badass: Making Users Awesome this week in the Game Development forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Problems with Jacob Dispatch Class" Watch "Problems with Jacob Dispatch Class" New topic

Problems with Jacob Dispatch Class

Steve Stanicki

Joined: Sep 24, 2005
Posts: 23
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*;

The problem is I have an example from 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 =, "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.

I agree. Here's the link:
subject: Problems with Jacob Dispatch Class