Access.2007.VBA.Bibl..

(John Hannent) #1
Write final line.

strText = “End of File”
txt.WriteBlankLines Lines:=1
txt.WriteLine Text:=strText

Case 3

VB

Open text file for writing information about export progress.

Open strFile For Output As #1
strText = “Information on progress creating “ _
& “Outlook mail messages”
Print #1, strText
Print #1,
Print #1,

blnSomeSkipped = False

For Each varItem In lst.ItemsSelected

Get 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”
Print #1,
Print #1, strText
GoTo NextContactVB
End If

Check for company name.

strCompanyName = Nz(lst.Column(3, varItem))
strTest = strCompanyName
Debug.Print “Company name: “ & strTest

Part II Writing VBA Code to Exchange Data between Office Components

Free download pdf