用VB关网页的代码怎么写啊 就是比如打开一个网页5秒中后自动关闭对别的没有影响

来源:百度知道 编辑:UC知道 时间:2024/06/29 01:10:12
Private Sub Command1_Click()
q = Text1.Text
Shell "explorer.exe ""http://www.baidu.com"
End Sub

这样然后5秒钟后关闭 自动的
要直接关的 不管是否打开

Private Sub Command1_Click()
Set ie = CreateObject("InternetExplorer.Application")
ie.navigate "www.baidu.com"
ie.Visible = True
Dendai 5 '调用延时函数,等待5秒种,当然5秒可以还打不开Baidu,就被关了。
ie.quit
Set ie = Nothing
End Sub

Private Sub Dendai(ByVal n As Single)
Dim tm1 As Single, tm2 As Single
tm1 = Timer
Do
tm2 = Timer
If tm2 < tm1 Then tm2 = tm2 + 86400
If tm2 - tm1 > n Then Exit Do
DoEvents
Loop
End Sub

'VB6,XP测试通过