Question : WebBrowser and Knowing when page is loaded

I am aware of how to create a WebBrowser in Access, however, how do I get Access to know when the Browser has finished loading the page?  The reason I ask is that I have a form that will load a page and when the page is done running, the form will automatically close.  I have tried using the '.busy' method but it does not seem to work.

I am using Access 2000

Answer : WebBrowser and Knowing when page is loaded

Hi jwhiteman1967,

I have IE as an object in my Form, and used :
    While web.Busy  'wait until the site fully loads
        DoEvents
    Wend

and

    While web.ReadyState <> 4 'wait until the site fully loads
        DoEvents
    Wend

but found that both doesn't get the job done,
the only thing that I found to work is:

1. make an unbound control on the Form, call it, TempURL,
2. we will let this Control hold the initial url,
    so depending on how you open this url (some do it 'On Load'), then have this code:
    me.TempURL= web.LocationURL
3. then have this code

    'wait until the browser goes to the Approval page
StartAgain:
    If web.LocationURL = TempURL Then
        'pause 2 seconds
        PauseTime = 2    ' Set duration.
        Start = Timer    ' Set start time.
        Do While Timer < Start + PauseTime
            DoEvents    ' Yield to other processes.
        Loop
        GoTo StartAgain
    End If
 


jaffer
Random Solutions  
 
programming4us programming4us