Access.2007.VBA.Bibl..
Check for the template in the selected template folder, and exit if it is not found: strTestFile = Nz(Dir(strWordTemplate)) Debu ...
The code then sets a reference to the Word CustomDocumentProperties collection of the newly created document, and sets each docu ...
Open a new document based on the selected template: Set appWord = GetObject(Class:=”Word.Application”) appWord.Documents.Add str ...
Create a new save name with the incremented number: intSaveNameFail = True strSaveName = strDocType & “ “ & CStr(i) _ &a ...
Else MsgBox “Error No: “ & Err.Number _ & “; Description: “ & Err.Description Resume ErrorHandlerExit End If End Sub ...
For intIndex = 0 To intRows lst.Selected(intIndex) = False Next intIndex ErrorHandlerExit: Exit Sub ErrorHandler: MsgBox “Error ...
FIGURE 6.20 A Word document with Access data displayed in bookmarks. Check that at least one contact has been selected: Set lst ...
Check for required address information: strTest = Nz(lst.Column(5, varItem)) Debug.Print “Street address: “ & strTest If str ...
.GoTo what:=wdGoToBookmark, _ Name:=”EnvelopeNameTitleCompany” .TypeText Text:=strNameTitleCompany .GoTo what:=wdGoToBookmark, _ ...
Create a new save name with the incremented number: intSaveNameFail = True strSaveName = strDocType & “ “ & CStr(i) _ &a ...
The TypeText Method .................................................................................... For simple documents su ...
Dim intMod As Integer Dim lngCount As Long Dim lngSkip As Long Dim doc as Word.Document strLongDate = Format(Date, “mmmm d, yyyy ...
Determine whether the template is for labels or list, and move to the first data cell in table if needed: If Nz(InStr(strWordTem ...
End If strNameTitleCompany = _ Nz(lst.Column(2, varItem)) strWholeAddress = _ Nz(lst.Column(5, varItem)) strContactName = _ Nz(l ...
NextContact: Next varItem If Nz(InStr(strWordTemplate, “List”)) > 0 Then Delete redundant last (blank) row: With appWord.Sele ...
Save Word document: appWord.ActiveDocument.SaveAs strSaveNamePath With appWord .ActiveWindow.WindowState = wdWindowStateNormal . ...
FIGURE 6.23 An Avery 5161 mailing labels merge document filled with Access data. Lists The Word Catalog-type merge is very usefu ...
FIGURE 6.24 The Contact List filled with merged data from Access. If a merge document with the Merge Data.txt data source is ope ...
FIGURE 6.25 The third page of a mail merge form letters document. Private Sub MailMergeTextFile(strWordTemplate As String, _ str ...
strLongDate = Format(Date, “mmmm d, yyyy”) strShortDate = Format(Date, “m-d-yyyy”) strDocsPath = GetContactsDocsPath() Debug.Pri ...
«
5
6
7
8
9
10
11
12
13
14
»
Free download pdf