求用VB打开网页的代码

比如说按一个确定就打开百度网页,按关闭就关闭百度网页
2024-10-30 10:20:21
推荐回答(3个)
回答1:

Dim ie As Object
Private Sub Command1_Click()
Set ie = CreateObject("INTERNETEXPLORER.APPLICATION")
ie.Visible = True
ie.Navigate "http://www.baidu.com"
End Sub

Private Sub Command2_Click()
ie.quit
End Sub

回答2:

Private Sub Command1_Click() '确定
WebBrowser1.Navigate "www.baidu.com"
End Sub

Private Sub Command2_Click() ‘关闭
WebBrowser1.Navigate "about:blank"
End Sub

添加2个按钮控件 一个 web控件
需要更高级应用加我百度HI

回答3:

确定就打开可以,但是关闭不行