If strTest = “” Then
blnSomeSkipped = True
strText = “Contact No. “ & lngContactID _
& “ (“ & strFullName _
& “) skipped; no company name”
Print #1,
Print #1, strText
GoTo NextContactVB
End If
Has 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 With
NextContactVB:
Next varItem
If blnSomeSkipped = True Then
Write final line and close text file.
strText = “End of file”
Print #1,
Print #1, strText
Close #1
End If
End Select
Open text file in Notepad.
Shell “Notepad “ & strFile
ErrorHandlerExit:
Exit Sub
ErrorHandler:
Outlook is not running; open Outlook with CreateObject.
If Err.Number = 429 Then
Set appOutlook = CreateObject(“Outlook.Application”)
Resume Next
ElseIf Err.Number = 55 Then
Working with Files and Folders 9