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

C

csdjj

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!
 

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

Top