Wednesday, 16 January 2013

To find the specified string in Notepad using VB Scripting

To find the specified string in Notepad using VB Scripting

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("N:/Wireline ECC.txt", 1)
line_num = 0

Do Until objFile.AtEndOfStream
    strLine = objFile.ReadLine
    msgbox( strLine)
    line_num = line_num+1
         If  instr(1,strLine,"Online")<> 0 Then
               MyPos = instr(1,strLine,"Online")
               Msgbox "Line No: " &line_num& " Position: "&MyPos
        End If
Loop

objFile.Close
objFSO = nothing
objFile = nothing

No comments:

Post a Comment