|
-
Dec 17th, 2005, 05:23 AM
#1
Thread Starter
PowerPoster
Webbrowser ReadyState
I enter a stock code I want the price for in a hidden webbrowser control and then simulate clicking the submit button using the below code. The problem is the page hasn't finished loading by the time I get the source code of the page.
I thought the loop I've got would have worked but it doesn't?? Are there any other ways to "do nothing" until a page has finished displaying all text/images etc...??
VB Code:
WB1.Document.All("SecurityCode").Value = QuoteInfo(1, i) 'share code
WB1.Document.getElementById("btnAction").Click 'submit form
'while page is loading do nothing
Do While WB1.ReadyState <> READYSTATE_COMPLETE
DoEvents
Loop
'Get html source
SourceCode = WB1.Document.documentElement.OuterHTML
Last edited by lintz; Dec 17th, 2005 at 06:53 AM.
-
Dec 17th, 2005, 06:41 AM
#2
Re: Webbrowser ReadyState
 Originally Posted by lintz
Are there any other ways to "do nothing" until a page has finished displaying all text/images etc...??
Something like this ?
VB Code:
Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
If pDisp Is WebBrowser1.Object Then
Debug.Print "Finished Loading"
' Do your job
Else
' Do nothing
End If
End Sub
Last edited by iPrank; Feb 22nd, 2007 at 04:25 PM.
-
Dec 17th, 2005, 06:53 AM
#3
Thread Starter
PowerPoster
Re: Webbrowser ReadyState
Thanks Prank, added some further code and does what I'm after
-
Dec 17th, 2005, 06:56 AM
#4
Re: Webbrowser ReadyState
Glad to help
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|