Private WithEvents WebBrowser1 As WebBrowser
'按一下创建,再按一下移除
Private Sub Command1_Click()
If WebBrowser1 Is Nothing Then
Set WebBrowser1 = Me.Controls.Add("Shell.Explorer.2", "WebBrowser1")
WebBrowser1.Visible = True
WebBrowser1.Navigate "http://www.qxw8.com/"
Else
Me.Controls.Remove WebBrowser1
Set WebBrowser1 = Nothing
End If
End Sub
WebBrowser,,动态装入,用完再动态卸掉,释放内存,避免长时间运行,卡死状态。