FIGURE 6.18A combo box for selecting a Word template for merging data from Access.
The procedure then calls one of four procedures with the document file name (including path) and
extension as arguments, depending on the merge type.The cmdCreateDocuments_Clickprocedure is listed as follows:Private Sub cmdCreateDocuments_Click()On Error GoTo ErrorHandlerDim cbo As Access.ComboBox
Dim strCompanyName As String
Dim strContactName As String
Dim strJobTitle As String
Dim strTestFile As String
Dim strWordTemplate As String
Dim strTest As String
Dim strDocType As String
Dim strMergeType As String
Dim strExtension As StringCheck that a document has been selected:Set cbo = Me![cboSelectDocument]
strWordTemplate = Nz(cbo.Value)
If strWordTemplate = “” Then
MsgBox “Please select a document”
cbo.SetFocus
cbo.Dropdown
GoTo ErrorHandlerExit
End IfstrTemplatePath = GetContactsTemplatesPath()
Debug.Print “Template path: “ & strTemplatePath
strWordTemplate = strTemplatePath & strWordTemplateWorking with Word Documents and Templates 6