ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Macro message box - automate to say yes only if no is not selected (https://www.excelbanter.com/excel-discussion-misc-queries/238332-macro-message-box-automate-say-yes-only-if-no-not-selected.html)

csdjj

Macro message box - automate to say yes only if no is not selected
 
Hi all,

This one is a bit confusing but I'll try my best to explain clearly. Here's
the situation:
1. I have an Excel workbook that contains certain macros.
2. I have created a scheduled task to open the workbook (and perform the
macros) once a week.
3. In order to allow it to be truly automated, I have set
Application.DisplayAlerts = False which works fine.
4. On occasion, however, I might want to get into the file without running
the macros. I have set up a message box for this a la:
If MsgBox("Do you want to run the macros?", vbYesNo, "Macros") = vbYes
Then MacRun = True
If Not MacRun Then Exit Sub
The problem is, if I use this message box, then it will prevent the
scheduled task from running.

My idea for a solution is to have a time delay on the message box that says
- if it's not answered within 10 seconds, then Excel will automatically
select "yes" to it.

Is this possible? If so, can someone tell me how to do it?

Thanks!


All times are GMT +1. The time now is 06:27 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com