簡體   English   中英

Internet Explorer在Excel VBA中完成加載后運行功能

[英]Run a function after internet explorer finishes loading in Excel VBA

Function GetIE() As Object
  On Error Resume Next
  Set GetIE = CreateObject("InternetExplorer.Application")
End Function

Dim appIE As Object ' InternetExplorer.Application
Dim sURL As String

sURL = "https://xxx.xxx.xxx.xxx/pppp/"

Application.ScreenUpdating = False

Set appIE = GetIE
appIE.Visible = True

With appIE
    .navigate sURL & "login.php"
    .Visible = True
End With

我想在Internet Explorer完成加載后調用一個函數。 我怎么做?

With appIE
    .navigate sURL & "login.php"
    .Visible = True

    ' Enter a do loop until the *readyState* property of IE object becomes equal to 4
    Do
        If .readyState = 4 Then ' check the *readyState* property
            ' Call your function here
            Exit Do
        Else
            ' IE is not ready, allow other application events to run
            DoEvents
        End If
    Loop

End With

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM