Re: Reading a text file

From: Al Dunbar [MS-MVP] (alan-no-drub-spam_at_hotmail.com)
Date: 11/27/04


Date: Sat, 27 Nov 2004 00:29:54 -0700


"Gerry Hickman" <gerry666uk@yahoo.co.uk> wrote in message
news:e4OOnPz0EHA.260@TK2MSFTNGP11.phx.gbl...
> Hi,
>
> Who is going to keep exporting this file, and how often are they
> expected to do it? What is the exact look of the date in Excel, and what
> is the exact date string in the text file?

Better to bite the bullet and have the script leverage EXCEL to extract the
data directly from the spread***, which would remove the necessity of
manually exporting a csv file. This could be used to make the script more
immune to operator errors. For example, the script could store an indicator
back into the spread *** as to when it sent the email notification. If
someone accidentally ran it a second time, it could then avoid sending
duplicate messages.

/Al

> Mostro wrote:
>
> > Happy turkey day all.
> >
> > I would like to read in a text file (CSV) and search each line for a
> > specific detail. For example I have an excel spread *** with a list
of
> > technicians travel schedules. Each line has the tech's name, location of
> > travel, the date he/she is scheduled to go and a list of other fields.
> >
> > So my script would do something like this:
> >
> > date = now
> > set objFSO = CreateObject("Scripting.FileSystemObject")
> > Set objFile = objFSO.OpenTextFile("C:\test1.txt", 1)
> > Do Until objFile.AtEndOfStream
> > strLine = objFile.Readline
> >
> > <<some type of if exists statement>>
> > If a date on a line is equal to 3 days before the schedule date send a
> > notifcation. So, say a line reads the date of travel being next Sunday.
The
> > script would read the file and notify the user (send an email or
something)
> > 3 days prior to the travel date.
> > <<>>
> > Loop
> > objFile.Close
> >
> > Thanks in advance
> >
> >
> >
>
>
> --
> Gerry Hickman (London UK)