I have a WebBrowser Object in a form. I check the ReadyState and when the ReadyState has the value 4 I start processing the text content on the loaded webpage.
The problem is that I do not get out of the loop if I do not active a MsgBox. The MsgBox returns 1,2 or 3 the first time the loop i fired. Next time the MsgBox returns 4 and the loop is ended. If I deactivate the MsgBox I get a never ending loop. I have to use CTRL+Breake and vReadyState is 3. Any ideas?
The problem is that I do not get out of the loop if I do not active a MsgBox. The MsgBox returns 1,2 or 3 the first time the loop i fired. Next time the MsgBox returns 4 and the loop is ended. If I deactivate the MsgBox I get a never ending loop. I have to use CTRL+Breake and vReadyState is 3. Any ideas?
Code:
Private Sub WebBrowser0_Updated(Code As Integer)
Dim Text As String
Dim vReadyState 'check if page is fully loaded. 4 = loaded
vReadyState = 0
Do Until vReadyState = 4
vReadyState = Me!WebBrowser0.ReadyState
'MsgBox vReadyState
Loop
If vReadyState = 4 Then
On Error Resume Next
Text = WebBrowser0.Document.Body.InnerText
Me.Results = Text