I'm using the folowing code
I want a to look if the string "system on" is present in the textstream ts.
Subsequently the variable "answer" has to be set to "Yes" or "No"
Is this possible with a find funktion or does someone have a better idee.
Code:
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'' References:
'' MS DAO 3.6
'' MS Scripting Runtime
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub ReadTxtImport()
On Error GoTo Err_ReadTxtImport
Dim fs As FileSystemObject, fd As Folder, fc As Files, f As File, ts As TextStream '' Variables for FileSystemObject
'Dim rst As DAO.Recordset
Dim strFolder As String, strFile As String
Dim strLine As String, strLineReturn As String
Dim strMagnification As String, strHighTension As String
strFolder = "C:\TextFiles\"
Set fs = CreateObject("Scripting.FileSystemObject")
Set fd = fs.GetFolder(strFolder)
Set fc = fd.Files
For Each f In fc
Set ts = f.OpenAsTextStream(1, -2)
'Set rst = CurrentDb.OpenRecordset("tblTextFiles")
Do While ts.AtEndOfStream <> True
strFile = f.Name
strLine = ts.ReadLine
strLineReturn = Mid(strLine, InStr(strLine, "=") + 1)
If .....
End If
Loop
Next
ts.Close
rst.Close
Set rst = Nothing
Set ts = Nothing
Set fc = Nothing
Set fd = Nothing
Set fs = Nothing
Exit Sub
End Sub
I want a to look if the string "system on" is present in the textstream ts.
Subsequently the variable "answer" has to be set to "Yes" or "No"
Is this possible with a find funktion or does someone have a better idee.