View Single Post
 
Old 08-23-2020, 06:06 AM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,977
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

I don't know how you would approach this problem but I'll give you a couple of things you could explore.

I haven't used scheduled tasks before but is it possible to spawn two steps when the workbook opens via the scheduled task. For example, create a temp file and then open the workbook. The code in the workbook_Open event could check for the existence of this temp file and if it exists, delete it and assume the event was kicked off automatically.

Another alternative is for the scheduled task to be told to open the workbook and include a startup switch to let the macro know. In Word you can specify a macro to run via a startup switch but the following link doesn't include a switch for a macro so we need to think laterally. Looking at the options there, I would maybe specify a startup path and then have the Workbook_Open test what startup path is specified.
Start-up/Command-line Switches For Excel. Fix, Repair Or Customize Microsoft Excel
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote