If strTest = “” Then
blnSomeSkipped = True
strText = “Contact No. “ & lngContactID _
& “ (“ & strFullName _
& “) skipped; no company name”
tstr.WriteText Data:=vbCrLf
tstr.WriteText Data:=strText, _
Options:=adWriteLine
GoTo NextContactADO
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
NextContactADO:
Next varItem
If blnSomeSkipped = True Then
Write final line and save text file.
strText = “End of File”
tstr.WriteText Data:=vbCrLf
tstr.WriteText Data:=strText
tstr.SaveToFile FileName:=strFile, _
Options:=adSaveCreateNotExist
End If
Case 2
FSO
Set fso = CreateObject(“Scripting.FileSystemObject”)
Set txt = fso.CreateTextFile(FileName:=strFile, _
overwrite:=True)
strText = “Information on progress creating “ _
& “Outlook mail messages”
txt.WriteLine Text:=strText
txt.WriteBlankLines Lines:=2
blnSomeSkipped = False
For Each varItem In lst.ItemsSelected
Part II Writing VBA Code to Exchange Data between Office Components