'Count How many times the word "QTP" appeared in a text file

Dim objFso, objTextstream Set objFso = CreateObject("Scripting.FileSystemObject") Set objTextstream =objFso.OpenTextFile ("C:Documents and SettingsAdministratorDesktopgcreddy.txt")  Counter=0 Do Until objTextstream.AtEndOfStream  myLine = objTextstream.ReadLine  myWord=Split(myLine) x= Ubound(myWord)  For i = 0 to x    y=myWord(i)   If StrComp(y, "QTP",1)=0 Then   Counter=Counter+1  End If Next Loop Msgbox Counter objTextstream.Close Set objRegEx =Nothing Set objTextstream =Nothing Set objFso = Nothing



This site uses Akismet to reduce spam. Learn how your comment data is processed.