Delete existing file, if there is one.
Kill strFile
On Error GoTo ErrorHandler
Select Case intTextType
Case 1
ADO
Set tstr = New ADODB.Stream
tstr.Open
strText = “Information on progress creating “ _
& “Outlook mail messages”
tstr.WriteText Data:=strText, Options:=adWriteLine
tstr.WriteText Data:=vbCrLf & vbCrLf
blnSomeSkipped = False
For Each varItem In lst.ItemsSelected
Get the Contact ID and name for reference.
lngContactID = Nz(lst.Column(0, varItem))
Debug.Print “Contact ID: “ & lngContactID
strFullName = Nz(lst.Column(1, varItem))
Check for email address.
strEMailRecipient = Nz(lst.Column(2, varItem))
strTest = strEMailRecipient
Debug.Print “Email address: “ & strTest
If strTest = “” Then
blnSomeSkipped = True
strText = “Contact No. “ & lngContactID _
& “ (“ & strFullName _
& “) skipped; no email address”
tstr.WriteText Data:=vbCrLf
tstr.WriteText Data:=strText, _
Options:=adWriteLine
GoTo NextContactADO
End If
Check for company name.
strCompanyName = Nz(lst.Column(3, varItem))
strTest = strCompanyName
Debug.Print “Company name: “ & strTest
Working with Files and Folders 9