D
Dominic
Want the excel file to open so the date-dependent formulas refresh to the new
month. Then save the file. Can this be done?
month. Then save the file. Can this be done?
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Gord Dibben said:See Chip Pearson's site for OnTime method.
http://www.cpearson.com/excel/OnTime.aspx
Here is an example using Chip's procedures.
In a General Module..........................
Public RunWhen As Double
Public Const cRunIntervalSeconds = 120 ' two minutes
Public Const cRunWhat = "TheSub"
Sub StartTimer()
RunWhen = Now + TimeSerial(0, 0, cRunIntervalSeconds)
Application.OnTime EarliestTime:=RunWhen, Procedure:=cRunWhat, _
Schedule:=True
End Sub
Sub Example_Macro()
ActiveSheet.Range("A1:F10").Interior.ColorIndex = 3
End Sub
Sub TheSub()
ThisWorkbook.Save
StopTimer
Application.Quit
End Sub
Sub StopTimer()
On Error Resume Next
Application.OnTime EarliestTime:=RunWhen, Procedure:=cRunWhat, _
Schedule:=False
End Sub
In Thisworkbook Module..............................
Private Sub Workbook_Open()
Example_Macro 'runs the macro
StartTimer 'starts the timer to save workbook and shut down Excel
End Sub
I''ll leave it to you to figure out a way to prevent macro warning when
workbook opens.
Gord
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.