Hi, I'm fairly new to QTP and am having some problems trying to record a checkpoint in Notepad. I've tried all the different checkpoints but nothing seems to work, they all check notepad as a whole document and not just the piece of text I've selected. Am I missing something?
Is the text in notepad there because you have opened a text file or there through some other means?
If its a text file then indeed using a FSO will fix it. Try this:
Const ForReading = 1, ForWriting = 2, ForAppending = 8
if instr(1,text_file,text_searched_for,vbTextcompare) >0 then
msgbox "Text found in file!"
' do some more stuff!
msgbox "Text not found in file. Sorry!"
' do more stuff
You need to set the filename you are using.
Hope this helps you out!
Actually a text checkpoint will enable you to check specific text in the document only. You can also highlight text and do a standard checkpoint to check the text selection. However, the other suggestions are what I currently use.