I am using the following expression that will open and display a mail merge word document from an access form. The only problem is that it opens the first record of the query as opposed to the specific record that i am in.
How do i open up the specific record and is it possible to automatically save the mail merge document in a specific directory which is named after a feild name such as 2142.doc
Thanks and help greatly appreciated.
Private Sub Command117_Click()
On Error GoTo Err_Command117_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 = "E:\mergetemp.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_Command117_Click:
Exit Sub
Err_Command117_Click:
MsgBox Err.Description
Resume Exit_Command117_Click
End Sub
How do i open up the specific record and is it possible to automatically save the mail merge document in a specific directory which is named after a feild name such as 2142.doc
Thanks and help greatly appreciated.
Private Sub Command117_Click()
On Error GoTo Err_Command117_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 = "E:\mergetemp.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_Command117_Click:
Exit Sub
Err_Command117_Click:
MsgBox Err.Description
Resume Exit_Command117_Click
End Sub