I have Excel VBA code that opens a Word 2010 document and calls the Word macro. The Word macro is a simple print program which I have checked and it works as it should.
If I step through the Excel macro then everything works as intended. However if I attempt to run the macro, it gets to the "oWord.Run MacroName" line and then I get the following error display!
Can anybody help please? It is driving me demented!
If I step through the Excel macro then everything works as intended. However if I attempt to run the macro, it gets to the "oWord.Run MacroName" line and then I get the following error display!
Code:
Sub PrintWordDoc()
Dim oWord As Word.Application
Dim oDoc As Word.Document
Set oWord = CreateObject("Word.Application")
Set oDoc = GetObject("D:\_DATA\My_Doc.docm")
oWord.Visible = True
oWord.Run MacroName:="PrintCarryDoc"
oWord.ActiveDocument.Save
oWord.Quit
Set oWord = Nothing
End Sub
Can anybody help please? It is driving me demented!