Is it possible to check if there is any value in a txt.file?
ie: If Open "C:\xxx.txt"= "" then....
what will be the correct expression above?
Printable View
Is it possible to check if there is any value in a txt.file?
ie: If Open "C:\xxx.txt"= "" then....
what will be the correct expression above?
Open the file for reading, read in each line, check for your string, if it exists do your routine, if it it doesnt read the next line. Do until you reach the end of the file.
how do i check for the existence forany string?
i use this:
Get #intFNum, 1, intClickCount
If intClickCount ="" Then
Put #intFNum, 1, 1
Else
intClickCount = intC....
the intClickCount ="" is not correct....how to expression it?
VB Code:
Option Explicit Private Function GetFileContents(fileName As String) As String If Dir(fileName) <> "" Then Open fileName For Binary As #1 GetFileContents = Input(LOF(1), 1) Close #1 End If End Function Private Sub Command1_Click() If InStr(GetFileContents("c:\autoexec.bat"), "data to search for") Then 'do your struff Else 'doesnt exist... what now End If End Sub