您的位置:首页 > 其它

Excel 打开执行某方法,定时关闭

2016-04-06 10:18 447 查看
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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: