您好,我嘗試用VB控制internet explorer,目前已經實作了啟動IE,并訪問某個網址(如百度),計劃在關閉IE前,彈出一個對話框請用戶進行確認,思路是通過onquit事件來實作
但是一直沒有得到目標效果,直接關閉了但并沒有彈出msgbox
main代碼如下:
Sub main()
Dim x As New Class1
x.Navigate "www.baidu.com"
End Sub
類模塊代碼如下:
Dim WithEvents ie As SHDocVw.InternetExplorer
Public Sub Navigate(ByVal txtAddress As String)
On Error Resume Next
If ie = "" Then
Set ie = GetObject("", "InternetExplorer.Application")
End If
ie.Visible = True
ie.Navigate2 txtAddress
' ie.TheaterMode = True
' ie.FullScreen = False
' ie.ToolBar = False
' ie.MenuBar = False
' ie.StatusBar = False
' ie.Resizable = False
End Sub
Public Sub ie_OnQuit()
MsgBox 111
End Sub
求指教,謝謝!
uj5u.com熱心網友回復:
真誠求助。。。一定是哪兒里不對了轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/78302.html
標籤:API
