MrExcel Publishing
Your One Stop for Excel Tips & Solutions

How can I start a word macro from excel macro


Posted by Marcus on May 10, 2001 3:37 AM

If I only had the help file installed...

How can I tell the excel macro I'm writing to open
a macro in the word document it is working with.

I've tried Application.run "macro name"
obviously this doesn't work, as it cannot find it.
How do I direct it to look in the right place?

Regards

Marcus


Posted by Ivan Moala on May 10, 2001 6:47 AM

Hi Marcus
You will need to referene the Word object library
then use code similar to this;

Sub RunWordMacro()
Dim WordObj As Word.Application
Set WordObj = CreateObject("word.application")
With WordObj
.Documents.Open "C:\My Documents\FaxMCC.Doc"
.Visible = True'Or False if you don't want it visible
.Run "MyMacro"
.Quit
End With
Set WordObj = Nothing
End Sub

Ivan