DocumentComplete EventDocumentComplete Event*
*



Contents  *



Index  *Topic Contents
*Previous Topic: CommandStateChange Event
*Next Topic: DownloadBegin Event

DocumentComplete Event

Description

Occurs when the document that is being navigated to reaches the READYSTATE_COMPLETE state.

Syntax

Private Sub object_DocumentComplete(ByVal pDisp As Object, URL As Variant)

ValueDescription
object An object expression that evaluates to an object in the Applies To list.
pDisp An object that evaluates to the top-level or frame WebBrowser object corresponding to the event.
URL A string expression that evaluates to the URL, UNC file name, or PIDL that was navigated to. Note that this URL can be different from the URL that the browser was told to navigate to. One reason is that this URL is the canonicalized and qualified URL; for example, if an application specified a URL of "www.microsoft.com" in a call to the Navigate or Navigate2 method, the URL passed by DocumentComplete will be "http://www.microsoft.com/". Also, if the server has redirected the browser to a different URL, the redirected URL will be reflected here.

Remarks

For a document without frames, this event will fire once when the document is finished loading. On a document containing multiple frames, this event is fired once for each frame. When the multiple-frame document has finished loading, the top-level frame fires the event one final time. To detect the last DocumentComplete event of a multiple-frame document, compare the pDisp object returned from the event to the WebBrowser object itself. The following example indicates how to trap the final DocumentComplete event.

Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
    If (pDisp Is WebBrowser1.Object) Then
        Debug.Print "Document is finished loading."
    End If
End Sub

Applies To

InternetExplorer, WebBrowser

See Also

BeforeNavigate2, Navigate, Navigate2, READYSTATE


Up Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.