Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Executing Word Macros from VB

Status
Not open for further replies.

Hexonx

Programmer
Jan 10, 2001
102
US
Has anyone run Word macros externally via the Word object model? The MSDN docs describe using the Application.Run method, which I am using. This is my source:

My macro looks like this:

In Normal template, module MyMacros:
public sub DoSomething()
' Something done here
end sub

My code looks like this:

anOpenDoc.Application.Run("Normal.MyMacros.DoSomething")

I receive error "Unable to run the specified macro".

To make sure I was making the correct call, I added another module to the document (not in Normal) and stepped through this call:

Application.Run("Normal.MyMacros.DoSomething")

This, of course, work correctly. Anyone know what I'm doing wrong?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top