Vb

The last method, VB, uses the Open strTextFileForlnput As #2 statement to open the file, and sets up a Do While . . . Loop structure to process all of the lines in the text file, saving data from each line to the strData variable, incrementing it line by line with a vbCrLf constant in between lines. When all the lines have been processed, the text file is closed.

Finally, however the data has been accumulated, the strData variable is written to the txtImportedText textbox, as shown in Figure 9.15.

A form with data loaded from a text file, using the FileSystemObject method.

Import Data from Text File

Information on progress creating Outlook mai

messages

-

Contact No. 440 (Armstrong, Harriette) skipped

no email address

Contact No. 292 (Bartlett, Peter) skipped; no em

ail address

Contact No. 493 (Burton, Nicholas) skipped; no

company name

Contact No. 128 (Foster, Lei and) skipped; noco

npany name

Contact No. 426 (Goldwater, Russell) skipped;

o email address

Contact No. 121 (Laughlin, Vicki) skipped; no en

nail address

Contact No. 114 (Marx, Sean) skipped; no emai

address

Contact No. 297 (Murray, Kirk) skipped; no com

panyname

Contact No. 236 (Pruitt, Muriel) skipped; no em

ail address

Select Text File ] D:\Documents\ProgressReports\SklppedRecords.txt Text Type

I Load Data From File [ Clear Imported Data

Select Text File ] D:\Documents\ProgressReports\SklppedRecords.txt Text Type

I Load Data From File [ Clear Imported Data

0 0

Post a comment