Executing Word macros from another program

A

Andreas

This is not necessarily VBA related, but I was wonderng if anyone knew of a
way of executing a Word macro from another program.

Basically, I have a macro written in the macro language and I want it to run
on an open Word document. Instead of having the user execute it through the
Tools->Macros menu, however, I am writing a seperate program that will tell
Word to execute the macro. If anyone knows how to do this in any language, I
would be much obliged.

Cheers,
Andreas
 
J

Jonathan West

Andreas said:
This is not necessarily VBA related, but I was wonderng if anyone knew of
a
way of executing a Word macro from another program.

Basically, I have a macro written in the macro language and I want it to
run
on an open Word document. Instead of having the user execute it through
the
Tools->Macros menu, however, I am writing a seperate program that will
tell
Word to execute the macro. If anyone knows how to do this in any language,
I
would be much obliged.

To see how to control Word from another program take a look at this article

Control Word from Excel
http://www.word.mvps.org/FAQs/InterDev/ControlWordFromXL.htm

The same principles apply whether it is Excel or any other program doing the
controlling.

To force Word to run a macro, you use the Application.Run method, and supply
the maco name as a string.

--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
 

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