'Return number of times a string occurs in a text file.
Dim fso, f
Source_file= "c:internet.txt"
Word_to_search= "www"
pointer=1
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso_OpenTextFile(Source_file, 1, True)
do while f.AtEndOfStream<> True
pointer=1
MyText=f.ReadLine
do while instr(pointer,MyText,word_to_search) > 0
'msgbox MyText & vblf & instr(pointer,MyText,word_to_search)
pointer=instr(pointer,MyText,word_to_search)+1
counter=counter+1
loop
loop
f.Close
msgbox "The text " &chr(34) &Word_to_search&chr(34) &" occurs " & counter & " times in the file "&chr(34) & Source_file&chr(34)