给你一个例子,它可以实现自动存盘功能,希望它对你有所帮助:
Dim i As Integer
Private Sub Form_Load()
returnvalue=Shell("notepad .exe", 3) '记事本窗体最大化
AppActivat = returnvalue '激活记事本
Timer1.Interval = 1000
'定时器timer事件的时间间隔约1秒
Form1.WindowState = 1 'form窗体最小化
Timer1.Enabled = True '启动定时器
End Sub
Private Sub Timer1_Timer()
i = i + 1 '计数器加一
If i = 300 Then
'约5分钟保存一次,可酌情'改变
i = 0 '计数器清零
SendKeys "%(F)", True '送出Alt+F键
SendKeys "S", True '送出S键
End If
End Sub