Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Webbrowser Frame Text

Using ms access 2003 I have a form with the webbrowser control. I navigate to a site that displays a page with the main content in a frame withing the page. I need a way to select the inside scrolling window frame of the page and then select/copy all text within the frame. So far i have been unable to get the text programatically.

I have tried tried setting the focus to the webbrowser object and trying to select all and copy using:

Forms![myform].WebBrowser4.SetFocus
SendKeys "{tab}"
SendKeys "^(A)"
SendKeys "^(C)"

When I try this the tab key seems to work, but not the select all/copy. Manually this works by clicking in the middle of the webpage and doing a CTRL A and CTRL C of course.

I have also tried using the innertext method:
strMyText = Forms![myform].WebBrowser4.Document.body.InnerText

Neither of these work.

It seems that I need to find the frame name of the window that I want text copied from, but I need some help to determine it or how to get the middle content from the web page visited.

Any help is greatly appreciated

Thanks
Alan
[1151 byte] By [alanfink] at [2007-11-11 7:54:24]
# 1 Re: Webbrowser Frame Text
I believe there is a Frames collection:

WebBrowser1.document.frames(2).document.body.innerhtml
pclement at 2007-11-11 23:47:37 >
# 2 Re: Webbrowser Frame Text
That worked!!!
strMyInvoiceText = Forms![myform].WebBrowser4.Document.frames(1).Document.body.innertext

THANKS FOR THE TIP!!

Alan
alanfink at 2007-11-11 23:48:36 >