Detect Excel was started with Windows Task Scheduler

  • Thread starter Thread starter RB Smissaert
  • Start date Start date
R

RB Smissaert

Using Excel 2000 to 2003.
I need to somehow detect that Excel was started with the Task Scheduler.
I don't need to open any particular workbook, but Excel has an add-in
installed that will open
(but load, so tick under Tools, Add-ins) an other add-in. This second add-in
will run code
with the workbook Open event. This code should only run though if Excel was
started with
the scheduler.
I have found only solution sofar, which involves opening a workbook with the
/p flag with a directory
as an argument but this doesn't work.
Thanks for any advice with this tricky problem.

RBS
 
Found a solution to this.
Maybe not the nicest one (the Windows task won't show the Excel icon), but
it works.
The Windows task will start a .bat file with this text:

@echo off
%1test > c:\zzzzz.txt
start Excel
exit

My add-in will check for the presence of this file and if it is there kill
it and run the code.
Will be interested if somebody has a better solution.


RBS
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top