I have a Excel database with records, and a Word file with a customized template.
Upon the opening of the Word file, the Excel data are required to connect to the Word and execute mail merge.
The code below works well and is inserted into the Word 's Module.
However, it always prompts the user to select the Excel path during start.
As the path of that Excel file is always fixed, how to amend code such that, during the next file opening, no path selection is required?
Thanks !
Upon the opening of the Word file, the Excel data are required to connect to the Word and execute mail merge.
The code below works well and is inserted into the Word 's Module.
Code:
' [ Doc_Open ]
Private Sub Document_Open()
'------------------------------
With ActiveDocument.MailMerge
.Destination = wdSendToNewDocument
.SuppressBlankLines = True
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
.Execute Pause:=False
End With
'------------------------------
End Sub
As the path of that Excel file is always fixed, how to amend code such that, during the next file opening, no path selection is required?
Thanks !
Last edited: