更新时间:2022-12-02 18:33:24
更好地使用 vbs 如你所说
vbs
,这是一个文本文件与 .vbs 扩展名(见下面的示例代码) vbs
vbs
在预定的时间打开工作簿
然后是: ThisWorkbook中使用 Private Sub Workbook_Open()
事件
模块在文件打开时运行代码 Application.Run
code code code $运行宏vbs
, which is a text file with a .vbs extension (see sample code below)vbs
vbs
to open the workbook
at the scheduled time and then either:
Private Sub Workbook_Open()
event in the ThisWorkbook
module to run code when the file is openedApplication.Run
in the vbs
to run the macro样本vbs
Dim ObjExcel, ObjWB
Set ObjExcel = CreateObject("excel.application")
'vbs opens a file specified by the path below
Set ObjWB = ObjExcel.Workbooks.Open("C:\temp\rod.xlsm")
'either use the Workbook Open event (if macros are enabled), or Application.Run
ObjWB.Close False
ObjExcel.Quit
Set ObjExcel = Nothing