Hi!
In Excel Press Alt+F11 to Show The Visual Basic Editor.
Goto Tools>References and check microsoft word 9.0 object library.
Then Paste the following code into a new standard module:
Sub GetWord()
Dim MyWord As Word.Application ' Variable to hold reference
' to Microsoft Word.
Dim WordWasNotRunning As Boolean ' Flag for final release.
' Test to see if there is a copy of Microsoft Word already running.
On Error Resume Next ' Defer error trapping.
' Getobject function called without the first argument returns a
' reference to an instance of the application. If the application isn't
' running, an error occurs.
Set MyWord = GetObject(, "Word.Application"
If Err.Number <> 0 Then WordWasNotRunning = True
Err.Clear ' Clear Err object in case error occurred.
' Show Microsoft Word through its Application property.
MyWord.Application.Visible = True
' If this copy of Microsoft Word was not running when you
' started, create one using the CreateObject method.
If WordWasNotRunning = True Then
Set MyWord = CreateObject("Word.Application"
End If
MyWord.Run "YourMacroName"
Set MyWord = Nothing ' Release reference to the
' application and spreadsheet.
End Sub
smallcat wrote:
I have macros in both Excel and Word/Excel mail merge, and I would like to open them from the same location. Is it possible?
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.