On 2002-09-24 23:46, jwhite wrote:
Anno...it was a little longer than 20 minutes thank you! And I thought the original question may have been unclear and wanted to restate it, don't jump all over me buddy!
The text file is on the C: drive in a seperate folder and simply contains a date.
rgds
Jeff
Jeff...hey he is a fellow Aussie
You didn't specify the date format...
Here is one way ...Try this routine.
<pre/>
Sub ReadFromFile()
Dim Fs As FileSystemObject
Dim Ts As TextStream
Dim sVar
Dim TodaysDate
Dim Result As String
'// Change this constant to your Full path name
Const sFile As String = "C:AATextone.txt"
Const sLess As String = " Less then "
Const sGreater As String = " Greater then "
TodaysDate = Date
Set Fs = CreateObject("Scripting.FileSystemObject")
Set Ts = Fs.OpenTextFile(sFile)
With Ts
sVar = .ReadAll
.Close
End With
sVar = CVDate(sVar)
Result = IIf(TodaysDate < sVar, sLess, sGreater)
MsgBox "Text date:= " & sVar & vbCr & _
"Todays Date:= " & TodaysDate & vbCr & _
"Todays date is" & Result & "TextFile date!"
End Sub
</pre>