You can use this to allow the user to pick the document.
Public Function GetPath(sTitle As String, fDialogType As MsoFileDialogType, Optional sFilterName As String, Optional sFileName As String) As String
'Requires reference to Microsoft Office 12.0 Object Library.
Dim fDialog As Office.FileDialog
Dim varFile As Variant
Dim sReturn As String
'Set up the File Dialog.
Set fDialog = Application.FileDialog(fDialogType)
With fDialog
'Allow user to make multiple selections in dialog box.
.AllowMultiSelect = False
.Title = sTitle
'Clear out the current filters, and add our own.
If sFileName <> "" And sFilterName <> "" Then
.Filters.Clear
.Filters.Add sFilterName, sFileName, 1
Else
.Filters.Clear
.Filters.Add "All Files", "*.*", 1
End If
'Show the dialog box. If the .Show method returns True, the
'user picked at least one file. If the .Show method returns
'False, the user clicked Cancel.
If .Show = True Then
'Loop through each file selected and add it to the list box.
For Each varFile In .SelectedItems
sReturn = varFile
Next
If fDialogType = msoFileDialogFolderPicker Then
If Right(sReturn, 1) <> "\" Then
sReturn = sReturn & "\"
End If
End If
End If
End With
GetPath = sReturn
End Function
' Replace Path = wb.Path & "\pushmerge.dot" with the line below in your code
Path = GetPath("Select Word Document", msoFileDialogFilePicker, "Word Documents", "*.dot")
Bookmarks