Link to home
Start Free TrialLog in
Avatar of rbend
rbendFlag for United States of America

asked on

How to "find on this page" inside a MSBrowser control

I am displaying a text page using a MSInternet Control (browser).
What code will allow me to search the page for the occurance of a string and scroll the page to that point?
Avatar of Richie_Simonetti
Richie_Simonetti
Flag of Argentina image

hearing...
ASKER CERTIFIED SOLUTION
Avatar of Richie_Simonetti
Richie_Simonetti
Flag of Argentina image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of wsh2
wsh2

<ping>
Would SendKeys("^F")  (CTRL-F) do what you are after?
anthony_glenwright, nice and simple and works too!
It is matter of opinions, but to me, sendkeys is a "last resort".
Your comment has very good advantages: no create objects, don't waste resources, it's clever indeed.
Anyway, you need put others sendkeys to set text to search and push the search button.
Cheers
I agree about the sendkeys :-)

Here's a more elegant way

wbrDisplay.ExecWB OLECMDID_SHOWFIND, OLECMDEXECOPT_PROMPTUSER
Oops, my bad.  The webbrowser control does not support OLECMDID_SHOWFIND - ref:  http://support.microsoft.com/support/kb/articles/Q251/1/33.ASP
Avatar of rbend

ASKER

Richie:
I found the Microsoft HTML Object Library in the componants list and added it to the project but I still get "object required" on the line  
"Set ieDoc = web1.Document"
Do I have to add a module with something in it or what?
 
Avatar of rbend

ASKER

Richie:
I found the Microsoft HTML Object Library in the componants list and added it to the project but I still get "object required" on the line  
"Set ieDoc = web1.Document"
Do I have to add a module with something in it or what?
 
Avatar of rbend

ASKER

Sorry...found my error.
Great answer...
bb
Thanks!
I would like to say that Anthony's solution was a valid one.
It is a pity that OLECMDID_SHOWFIND doesn't works. I like that approach more than mine!
Cheers