I have a macro named peter
Which is located in teh following file.
\company\PLANNING\Informationplanning\Templates\Vodafone\Database\PRE-AP-Parish1.doc
The code below opens a word document however i would also like it to run the macro named Peter.
What is the correct syntax for the code that i need to include to be able to run the macro.
Any help much appreciated.
Private Sub Command596_Click()
Dim stDocName As String
stDocName = "refresh"
DoCmd.RunMacro stDocName
On Error GoTo Err_Command596_Click
' Button launches Word and opens a specified document
' And runs an optional macro. the macro could print out the word doc and quit
Dim retval As Variant
Dim DocName, MacroName As String
' Drive and Full path to name and location of Word document
DocName = "\\Cpsglobal01\company\PLANNING\Informationplanning\Templates\Vodafone\Database\PRE-AP-Parish1.doc"
'Optional Macro Name. Note Word Macro name cannot have any spaces in it.
'MacroName = "/M" & "MacroName"
'Note full path to Word including Drive and folder
retval = Shell("C:\Program Files\Microsoft Office\Office\winword.exe" & " " & DocName & MacroName, vbNormalFocus)
Exit_Command596_Click:
Exit Sub
Err_Command596_Click:
MsgBox Err.Description
Resume Exit_Command596_Click
End Sub
Which is located in teh following file.
\company\PLANNING\Informationplanning\Templates\Vodafone\Database\PRE-AP-Parish1.doc
The code below opens a word document however i would also like it to run the macro named Peter.
What is the correct syntax for the code that i need to include to be able to run the macro.
Any help much appreciated.
Private Sub Command596_Click()
Dim stDocName As String
stDocName = "refresh"
DoCmd.RunMacro stDocName
On Error GoTo Err_Command596_Click
' Button launches Word and opens a specified document
' And runs an optional macro. the macro could print out the word doc and quit
Dim retval As Variant
Dim DocName, MacroName As String
' Drive and Full path to name and location of Word document
DocName = "\\Cpsglobal01\company\PLANNING\Informationplanning\Templates\Vodafone\Database\PRE-AP-Parish1.doc"
'Optional Macro Name. Note Word Macro name cannot have any spaces in it.
'MacroName = "/M" & "MacroName"
'Note full path to Word including Drive and folder
retval = Shell("C:\Program Files\Microsoft Office\Office\winword.exe" & " " & DocName & MacroName, vbNormalFocus)
Exit_Command596_Click:
Exit Sub
Err_Command596_Click:
MsgBox Err.Description
Resume Exit_Command596_Click
End Sub