FIGURE 9.10
A form with options to create a text file with information about skipped records using three different methods.
The complete cmdCreateEMails_Clickevent procedure is listed next; the code first checks
that the message subject and body text have been entered on the form and sets a reference to the
Outlook Application object, deletes the old text file, if it exists, then sets up a Select Casestate-
ment to work with text files differently, according to which option was selected in the Text Type
option group:
Private Sub cmdCreateEMails_Click()
On Error GoTo ErrorHandler
Dim appOutlook As Outlook.Application
Dim fso As Scripting.FileSystemObject
Dim msg As Outlook.MailItem
Dim strBody As String
Dim strEMailRecipient
Dim strSubject As String
Dim strTo As String
Dim varItem As Variant
Dim strTest As String
Dim lngContactID As Long
Dim strFullName As String
Dim strText As String
Dim strCompanyName As String
Dim strDocsPath As String
Dim strFile As String
Working with Files and Folders 9