Share this Page URL

UserForms > UserForms - Pg. 443

Set lst = lstContacts lst.Column( ) = varContactArray Me![txtLetterText].Value = "Type letter text here" ErrorHandlerExit: Exit Sub ErrorHandler: MsgBox "Error No: " & Err.Number & "; Description: " & Err.Description Resume ErrorHandlerExit End Sub Private Sub cmdCancel_Click( Unload frmAccessData End Sub Private Sub cmdMerge_Click( On Error GoTo ErrorHandler Dim Dim Dim Dim Dim Dim Dim intItem As Integer intIndex As Integer intRow As Integer intRows As Integer intColumn As Integer intColumns As Integer strLetterText As String ) ) Set lst = lstContacts strLetterText = Me![txtLetterText] intRows = lst.ListCount - 1 For intItem = 1 To intRows If lst.Selected(intItem) = True Then 'Open a new letter based on the Normal template 'Debug.Print "Creating a letter to : " & Nz(lst.Column(3, intItem)) Application.Documents.Add 'Paste Outlook data to letter for each selected contact With Selection .ParagraphFormat.Alignment = wdAlignParagraphRight .InsertDateTime DateTimeFormat:="dddd, MMMM dd, yyyy", _ InsertAsField:=False, DateLanguage:=wdEnglishUS, _ CalendarType:=wdCalendarWestern, InsertAsFullWidth:=False .TypeParagraph .ParagraphFormat.Alignment = wdAlignParagraphLeft .TypeParagraph .TypeParagraph Working with VBA UserForms | 443