Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Problems with Jacob Dispatch Class

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*;

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.

Anderson gave himself the promotion. So I gave myself this tiny ad:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic