VB定时运行

来源:百度知道 编辑:UC知道 时间:2024/09/21 06:22:29
问一下:

在VB里,建一个"Command1"按钮,能不能自动按下,或者定时(某个时间或1分钟后)自动运行

也或者 某个时间自动运行某段代码程序,
比如:1点钟自动运行shell"C:\Program Files\Internet Explorer\IEXPLORE.EXE www.baidu.com"

怎么弄?(新人提问)

Private Sub Command1_Click()
MsgBox "hi"
End Sub

Private Sub Form_Load()
Command1_Click
End Sub
'过一段时间自动按可以用timer计时调用
'----------------------------------
Private Sub Timer1_Timer()
Dim s As Long
s = Hour(Time) & Minute(Time) & Second(Time)
If s = 100 Or s = 1300 Then Shell "iexplore.exe www.baidu.com"
's的为时分秒(如10:03:53则s=10353),上面考虑1点跟13点时自动运行
'timer的interval设为1000,enabled为true
End Sub