1.打开excel执行任务
//在thisworkbook 下添加此方法
Private Sub Workbook_Open()
Start //具体操作End Sub
2.定时关闭
Public a, b As Double
b = TimeValue("11:00:00")
Sub StartTimer2()
If timeb > d Then
ExcelClose
Exit Sub
End If
Application.OnTime timeb + TimeValue("00:00:01"), "getdata2"
timeb = timeb + TimeValue("00:01:00")
End Sub
//关闭操作
Sub ExcelClose()
Application.DisplayAlerts = False
Application.Quit
End Sub