在运行任务计划程序的Excel实例中打开一个Excel文件 [英] Open an Excel file in running instance of Excel with Task Scheduler
问题描述
我使用任务计划程序来自动化使用Excel的各种夜间任务。通常这个任务会打开一个新的Excel实例,该实例反过来打开一个指定的文件,该文件执行某些操作并关闭自身(和Excel)。
I use Task Scheduler to automate a variety of nightly tasks using Excel. Typically the task opens a new instance of Excel, which in turn opens a specified file, which does some stuff and closes itself (and Excel).
现在我有一个任务这需要一个加载项,并且加载项的使用需要单独的身份验证。没有办法传递我的凭据 - 当加载项加载时,我必须手动验证。因为老式的方式总是启动一个新的(未认证的)实例,我无法确定需要加载项的完全自动化任务。
Now I have a task that requires an add-in, and use of the add-in requires separate authentication. There is no way to pass my credentials - I have to manually authenticate when the add-in loads. Because the old-fashioned way always launches a new (unauthenticated) instance, I can't figure out how fully automate tasks that require the add-in.
一个解决方法在我离开之前打开一个Excel实例,为加载项进行身份验证,并使该实例保持打开状态。那么我理论上可以安排在这个实例中打开一些文件(而不是如上所述启动一个新的实例打开文件),并且做任何需要加载项的任务。
One workaround would be to open an instance of Excel before I leave, authenticate for the add-in, and leave that instance open. Then I could theoretically schedule the opening of some file within that instance (as opposed to launching a new instance to open the file, as described above) and do whatever the tasks were that required the add-in.
可以直接通过以某种方式定义任务,还是在可以按计划运行的.bat文件中执行此操作?
Is it possible to do this, either directly by defining the task a certain way, or in a .bat file that I can run on a schedule?
推荐答案
我有一个非常类似的问题,想知道你是否已经通过VBA(getobject(),sendmessage方法等)解决了这个问题。
我创建了一个单独的问题,只是显示我做了什么。 Windows FindWindows和SendMessgae自动认证excel VBA
基本上我坚持如何将用户名和密码传递给加载项弹出窗口。
I have a very similar problem and wondering if you have solved this problem through the VBA (getobject(), sendmessage method etc) yet. I created a seperate question on this just show what I have done. Windows FindWindows and SendMessgae for Auto-authentication excel VBA Basically I am stuck on how to pass user name and password to the add-in pop up window.
感谢百万次:)
这篇关于在运行任务计划程序的Excel实例中打开一个Excel文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!