有两种方法。一种是还是在原来的窗口上打开。另一种是新窗口上打开。
代码如下:
1.原来的窗口
Private Sub WebBrowser1_NewWindow2(ppDisp As Object, Cancel As Boolean)
Cancel = True
WebBrowser1.Navigate2 WebBrowser1.Document.activeElement.href
End Sub
2.新窗口
Private Sub WebBrowser1_NewWindow2(ppDisp As Object, Cancel As Boolean)
Dim NFrm As New Form1
NFrm.WebBrowser1.RegisterAsBrowser = True
Set ppDisp = NFrm.WebBrowser1.Object
NFrm.Visible = True
End Sub
Private Sub Command1_Click()
WebBrowser1.Navigate "baidu.com"
End Sub
莫非还有更复杂的打开方法???我只知道这一种``