Option ExplicitPrivate Sub Command1_Click() prog Timer1.Enabled = True End SubPrivate Sub Form_Load() Timer1.Enabled = False Timer1.Interval = 30000 End SubPrivate Sub Timer1_Timer() prog End Sub'执行程序段 Private Sub prog() Debug.Print "hello" '...........
End Sub
在一个timer里设置时间间隔为30秒 在timer事件中写: shell 程序名称 end sub
prog
Timer1.Enabled = True
End SubPrivate Sub Form_Load()
Timer1.Enabled = False
Timer1.Interval = 30000
End SubPrivate Sub Timer1_Timer()
prog
End Sub'执行程序段
Private Sub prog()
Debug.Print "hello"
'...........
End Sub
在timer事件中写:
shell 程序名称
end sub
在设计阶段将Timer的enable设为False,在一个Button的事件中讲timer的enable设为ture.
shell后面加的不是WINDOWS可执行的EXE程序吗?
他说的执行VB中的子程序
好象不能用shell吧~~
学习中~~~~
要实现你的要求就得用Timer1_Timer