Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WebBrowser does not refresh when READYSTATE_COMPLETE?

Status
Not open for further replies.

mingichu

MIS
Apr 12, 2002
29
US
Hi All experts.

I posted serveral questions here about the WebBrowser and got very good answers to come up the codes below. Thanks all the experts who have helped me earlier!

Need help again: There is a website (see the codes below). When it goes from page1 to page2, or page 2 to page3, the webbrowser's ReadyState becomes READSTATE_COMPLETE, but the webbrowser is not refreshed and still stays at the current page. Then I got error by trying to call the button of the next page.

I tried to use
Do Until frmWB.wb.ReadyState = READYSTATE_COMPLETE And _
Trim(frmWB.wb.LocationURL) <> vCurURL
DoEvents
Loop
It doesn't work either because the website URL doesn't change from page to page.

Is there another way to know how this website fully loaded and refreshed??
Any help would be greatly appreciated!!


== My codes =======================================
Public Sub ProcessCT(ByVal lState As String, _
ByVal lBusSrcName As String)

frmWB.wb.Navigate2 " Do Until frmWB.wb.ReadyState = READYSTATE_COMPLETE
DoEvents
Loop

Call frmWB.wb.Document.parentWindow.execScript _
("MM_swapImage('document.layers[\'Logo\'].document.Logo','document.Logo','images/ConcordButton.gif','#932951425980')", "JavaScript")
frmWB.wb.Navigate2 " Do Until frmWB.wb.ReadyState = READYSTATE_COMPLETE
DoEvents
Loop

'page 1
frmWB.wb.Document.All("13").Value = "1"
frmWB.wb.Document.All("DFH_ENTER").Click
Do Until frmWB.wb.ReadyState = READYSTATE_COMPLETE
DoEvents
Loop

'page 2
frmWB.wb.Document.All("13").Value = "1"
frmWB.wb.Document.All("DFH_ENTER").Click
Do Until frmWB.wb.ReadyState = READYSTATE_COMPLETE
DoEvents
Loop

'page 3
frmWB.wb.Document.All("14").Value = lBusSrcName
frmWB.wb.Document.All("DFH_ENTER").Click
Do Until frmWB.wb.ReadyState = READYSTATE_COMPLETE
DoEvents
Loop


'Print
frmWB.wb.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER

' Sign-Off
For vCtr = 0 To frmWB.wb.Document.All.length - 1
If UCase(frmWB.wb.Document.All(vCtr).tagName) = "INPUT" Then
If UCase(frmWB.wb.Document.All(vCtr).Value) = _
"SIGN-OFF OF THE CONCORD SYSTEM" Then
frmWB.wb.Document.All(vCtr).Click
End If
End If
Next

End Sub
 
I'm not sure why you use the .navigate2 property? I would change some of your code as follows:

[red] frmWB.wb.Navigate "[/red]
Do Until frmWB.wb.ReadyState = READYSTATE_COMPLETE
DoEvents
Loop

Call frmWB.wb.Document.parentWindow.execScript _
("MM_swapImage('document.layers[\'Logo\'].document.Logo','document.Logo','images/ConcordButton.gif','#932951425980')", "JavaScript")
[red]frmWB.wb.Navigate "[red]
Do Until frmWB.wb.ReadyState = READYSTATE_COMPLETE
DoEvents
Loop

'page 1
frmWB.wb.Document.All("13").Value = "1"
frmWB.wb.Document.All("DFH_ENTER").Click
Do [red]WHILE[/red] frmWB.wb.ReadyState = READYSTATE_COMPLETE
DoEvents
Loop

'page 2
frmWB.wb.Document.All("13").Value = "1"
frmWB.wb.Document.All("DFH_ENTER").Click
Do [red]WHILE[/red] frmWB.wb.ReadyState = READYSTATE_COMPLETE
DoEvents
Loop

'page 3
frmWB.wb.Document.All("14").Value = lBusSrcName
frmWB.wb.Document.All("DFH_ENTER").Click
Do [red]WHILE[/red] frmWB.wb.ReadyState = READYSTATE_COMPLETE
DoEvents
Loop


'Print
frmWB.wb.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER

' Sign-Off
For vCtr = 0 To frmWB.wb.Document.All.length - 1
If UCase(frmWB.wb.Document.All(vCtr).tagName) = "INPUT" Then
If UCase(frmWB.wb.Document.All(vCtr).Value) = _
"SIGN-OFF OF THE CONCORD SYSTEM" Then
frmWB.wb.Document.All(vCtr).Click
End If
End If
Next

The changes are marked in red. Change the marked untils with whiles, and that should solve your issue.

Good luck

BB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top