Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I wish to search for 2 separate strings in one file. I prefer to not follow
this sequence: (1) Open txt file (2) search for first string (3) output result (4) close txt file (5) repeat 1-4 for second string. I would like to perform the query without having to close and reopen the txt file. My current program resembles what it listed below. Obviously my syntax for "LineofText2" is incorrect, so please offer your suggestions. Is possible to do something along the lines of "Open fName For Input As #1 and #2"? thanks in advance. Open fName For Input As #1 sStr = "" sStr2 = "" Do While Not EOF(1) Line Input #1, LineofText If (InStr(1, LineofText, "Reboot", vbTextCompare)) Then sStr = Left(LineofText, 12) End If If (InStr(1, LineofText2, "Yes", vbTextCompare)) Then sStr2 = Mid(LineofText2, 12, 3) End If Loop Cells(iVar, "A").Value = sStr Cells(iVar, "B").Value = sStr2 Close #1 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
search for multiple strings | Excel Discussion (Misc queries) | |||
How do I filter or search mulitple for text strings? | Excel Discussion (Misc queries) | |||
Search for multiple strings in a list (w/in 1 cell) w/ Advanced fi | Excel Discussion (Misc queries) | |||
Search multiple strings in each cell | Excel Programming | |||
Search multiple strings Difficult to figure out | Excel Programming |