johnny51981
Active Member
- Joined
- Jun 8, 2015
- Messages
- 366
I have a workbook that I need to run in the later hours to have ready in the morning, due to its lengthy refresh time.
The Scheduled Task is set up and tested with success.
The VBA to run the needed macros on open is set up and tested, also successfully.
Now, what I am trying to figure out is to allow for updating of the workbook's structure/criteria whenever needed, but giving myself or other users the ability to cancel the lengthy refresh.
Would someone be able to assist in providing the VBA on how to allow for a MsgBox to appear with any kind of Yes/No that will cancel the procedure if No is selected, but if nothing is selected within a minute and a half, then it defaults to Yes and then initiates the lengthy refresh?
Here is the MsgBox VBA that I have as of now:
The Scheduled Task is set up and tested with success.
The VBA to run the needed macros on open is set up and tested, also successfully.
Now, what I am trying to figure out is to allow for updating of the workbook's structure/criteria whenever needed, but giving myself or other users the ability to cancel the lengthy refresh.
Would someone be able to assist in providing the VBA on how to allow for a MsgBox to appear with any kind of Yes/No that will cancel the procedure if No is selected, but if nothing is selected within a minute and a half, then it defaults to Yes and then initiates the lengthy refresh?
Here is the MsgBox VBA that I have as of now:
VBA Code:
Sub MsgBoxBeforeRunning()
Dim answer As Integer
answer = MsgBox("Would you like to continue with the data refresh?", vbQuestion + vbYesNo)
If answer = vbNo Then
Exit Sub
Else
Application.Wait (Now + TimeValue("0:01:30"))
Exit Sub
End If
End Sub