I need to be able to check a flat file for key phrases How can I do this:
Exampe.
ITEM_BLOCK MASTER_MAINTENANCE /ROW=3 /COL=7 &
/FACILITY=MENU_MASTER_MAINTENANCE
I need to look for /Facility in the block above..
Thanks
Brooke
Printable View
I need to be able to check a flat file for key phrases How can I do this:
Exampe.
ITEM_BLOCK MASTER_MAINTENANCE /ROW=3 /COL=7 &
/FACILITY=MENU_MASTER_MAINTENANCE
I need to look for /Facility in the block above..
Thanks
Brooke
fastest and easiest way is to pop the file into a richtext box control. This control has a built in "Find" function. If you need further help, send me your email address and I will send you a sample file tonight.
I sent a file call "Richie Rich.Zip". It should have what you are looking for.
See Ya
If you're looking to check a file for a key phrase without actually having to display the file then you can use the InStr function. The example code below opens the C:\Autoexec.bat file and searches it for the Word "DOS".
Hope this helps.Code:Dim strLine As String
Dim intAnswer As Integer
Dim strFind as String
Dim strFile as String
strFind = "DOS"
strFile = "C:\autoexec.bat"
Open strFile For Input As #1
Do While Not EOF(1) ' Loop until end of file.
Line Input #1, strLine ' Read line into variable.
'Look for specific text.
intAnswer = InStr(1, strLine, strFind)
If intAnswer <> 0 Then
MsgBox "String Found"
End If
Loop
Close #1 ' Close file