Hi..
I'm trying to Auto Save my workbook every 60 seconds. I have the following code in ThisWorkbook. When the code pops off the timer, I get a message displayed Cannot run the macro "C:\... shows the path with the path ending in !TheSub. The macro may not be available in the workbook or all marcos may be disabled."
The following is in a Module:
Do I not have the subs setup properly? My Marcos are enabled.
Thanks for the help.
I'm trying to Auto Save my workbook every 60 seconds. I have the following code in ThisWorkbook. When the code pops off the timer, I get a message displayed Cannot run the macro "C:\... shows the path with the path ending in !TheSub. The macro may not be available in the workbook or all marcos may be disabled."
Code:
Private Sub Workbook_Open()
Call StartTimer
End Sub
Sub StartTimer()
RunWhen = Now + TimeSerial(0, 0, cRunIntervalSeconds)
Application.OnTime EarliestTime:=RunWhen, Procedure:=cRunWhat, _
Schedule:=True
End Sub
Sub TheSub()
''''''''''''''''''''''''
ActiveWorkbook.Save
MsgBox "Master Schedule Saved"
''''''''''''''''''''''''
StartTimer ' Reschedule the procedure
End Sub
Code:
Public RunWhen As Double
Public Const cRunIntervalSeconds = 60 ' 1 minute
Public Const cRunWhat = "TheSub" ' the name of the procedure to run
Do I not have the subs setup properly? My Marcos are enabled.
Thanks for the help.