Given a text file test.txt
:
Ford
Jeep
Honda
The following script is processing this text file:
'Read in File Data to an array, separate by newline vb equivalent (vbcrlf)
Dim car, cars
Dim filefullname : filefullname = "C:\testenv\test.txt"
cars = Split(CreateObject("Scripting.FileSystemObject").OpenTextFile(filefullname, 1).ReadAll, vbcrlf)
'Exact Match search.
Dim searchstring : searchstring = "Jeep"
For Each car In cars
If Car = searchstring Then Exit For
Next
'Partial Match search
'Instr returns >0 if any result is found, if none, InStr returns -1
'The If statement will use -1 = false, >0 = true
Dim searchstring : searchstring = "Jee"
Dim position
For car = 0 To ubound(cars)
If InStr(cars(car), searchstring) Then
position = car
Exit For
End If
Next