Java calling VBA

J

jtanaka

Would anyone have any recommendations on a way to call VBA Subs from Java?
I have a need to pull Word documents from our PDM system whose API is in
Java and run macros contained in these word documents.

Specifically, the Word .doc binary is stored in our PDM system and I need
to pull the file from PDM and do a Save As XML to extract XML data from these
documents.

If anyone has any suggestions, please reply.
 
C

Cindy M.

Hi =?Utf-8?B?anRhbmFrYQ==?=,
Would anyone have any recommendations on a way to call VBA Subs from Java?
I have a need to pull Word documents from our PDM system whose API is in
Java and run macros contained in these word documents.

Specifically, the Word .doc binary is stored in our PDM system and I need
to pull the file from PDM and do a Save As XML to extract XML data from these
documents.
You can't do anything unless Word is installed on the system running the
application. In that case, you use Java to create or get a Word.Application
instance, assigning it to an object variable. You then use the
application.Documents.Open method to open the document. Application.Run will run
a macro. Or you should be able to use the SaveAs method to save the document
directly, without needing to run a macro.

An alternate approach would be to use the command line to open the document and
execute a macro available in Normal.dot. Example

"C:\path-to-winword.exe\winword.exe" "C:\path-to-doc\docname.doc"
/mMacroNameOfMacroStoredInNormaldot

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top