Dim blnSomeSkipped As Boolean
Dim intTextType As Integer
Dim strTitle As String
Dim strPrompt As String
Dim txt As Scripting.TextStream
Dim tstr As ADODB.Stream
Set lst = Me![lstSelectContacts]
intTextType = Nz(Me![fraTextType].Value, 2)
strDocsPath = GetCustomDocsPath()
Check that at least one contact has been selected.
If lst.ItemsSelected.Count = 0 Then
strTitle = “No contact selected”
strPrompt = “Please select at least one contact”
MsgBox prompt:=strPrompt, Buttons:=vbExclamation _
+ vbOKOnly, title:=strTitle
lst.SetFocus
GoTo ErrorHandlerExit
End If
Test for required message fields.
strSubject = Nz(Me![txtMessageSubject].Value)
If strSubject = “” Then
strTitle = “No subject entered”
strPrompt = “Please enter a subject”
MsgBox prompt:=strPrompt, Buttons:=vbExclamation _
+ vbOKOnly, title:=strTitle
Me![txtMessageSubject].SetFocus
GoTo ErrorHandlerExit
End If
strBody = Nz(Me![txtMessageBody].Value)
If strBody = “” Then
strTitle = “No message body entered”
strPrompt = “Please enter the message body”
MsgBox prompt:=strPrompt, Buttons:=vbExclamation _
+ vbOKOnly, title:=strTitle
Me![txtMessageBody].SetFocus
GoTo ErrorHandlerExit
End If
Checks passed; proceed to create a message using the selected text output method.
Set appOutlook = GetObject(, “Outlook.Application”)
strFile = strDocsPath & “Skipped Records.txt”
Debug.Print “Text file: “ & strFile
On Error Resume Next
Part II Writing VBA Code to Exchange Data between Office Components