If strTest = “” Then
blnSomeSkipped = True
strText = “Contact No. “ & lngContactID _
& “ (“ & strFullName _
& “) skipped; no company name”
Print #1,
Print #1, strText
GoTo NextContactVB
End IfHas required info; create new mail message and send to contact.
Set msg = appOutlook.CreateItem(olMailItem)
With msg
.To = strEMailRecipient
.Subject = strSubject
.Body = strBody
.Send
End WithNextContactVB:
Next varItemIf blnSomeSkipped = True ThenWrite final line and close text file.
strText = “End of file”
Print #1,
Print #1, strText
Close #1
End IfEnd SelectOpen text file in Notepad.
Shell “Notepad “ & strFileErrorHandlerExit:
Exit SubErrorHandler:Outlook is not running; open Outlook with CreateObject.
If Err.Number = 429 Then
Set appOutlook = CreateObject(“Outlook.Application”)
Resume Next
ElseIf Err.Number = 55 ThenWorking with Files and Folders 9