I want to use a VB app to open a word doc and launch a macro. I have the
following code:
Sub Main()
Dim docsObj As Word.Documents
Dim docObj As Word.Document
Dim appWord As Word.Application
Set appWord = CreateObject("word.application"
Set docsObj = appWord.Documents
Set docObj = docsObj.Open("C:\mydoc.doc"
docObj.Application.Run ("MyMacro"
docObj.SaveAs "MyNewName.doc"
On Error Resume Next
docObj.Close
On Error GoTo 0
Set docsObj = Nothing
Set docObj = Nothing
appWord.Quit
End Sub
I get an error when it gets to "docObj.Application.Run ("MyMacro"" saying that
macro could not be found. I know that the macro exists and the macro is saved in
normal.dot.
I am using VB6 and Word2000. Any ideas?
Thanks in advance.
following code:
Sub Main()
Dim docsObj As Word.Documents
Dim docObj As Word.Document
Dim appWord As Word.Application
Set appWord = CreateObject("word.application"
Set docsObj = appWord.Documents
Set docObj = docsObj.Open("C:\mydoc.doc"
docObj.Application.Run ("MyMacro"
docObj.SaveAs "MyNewName.doc"
On Error Resume Next
docObj.Close
On Error GoTo 0
Set docsObj = Nothing
Set docObj = Nothing
appWord.Quit
End Sub
I get an error when it gets to "docObj.Application.Run ("MyMacro"" saying that
macro could not be found. I know that the macro exists and the macro is saved in
normal.dot.
I am using VB6 and Word2000. Any ideas?
Thanks in advance.