如何使用 Windows 脚本关闭打开的文件?
我想设置一个脚本作为 Windows 计划任务每天运行。该脚本应打开一个 Excel 电子表格,等待其运行宏(该宏设置为在每次打开电子表格时运行),然后在宏完成保存更改后关闭文件。宏本身的运行时间不会很长。如果我的脚本可以在再次关闭文件之前等待大约一分钟,那就足够了。
I want to set up a script to be run daily as a Windows Scheduled Task. The script should open an Excel spreadsheet, wait for it to run a macro (which is set up to run every time the spreadsheet is opened), and then close the file after the macro finishes saving the changes. The macro itself won't take very long to run. If my script can just wait for about a minute before closing the file again, that should be sufficient.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
完全未经测试的代码,大部分是从内存中编写的,但希望足以让您开始:
Completely untested code and mostly written from memory but hopefully enough to get you started: