From: Eric on
Does anyone have any suggestions on how to set macro to run every 15 minutes?
Thanks in advance for any suggestions
Eric
From: ozgrid.com on
See:
http://www.ozgrid.com/Excel/run-macro-on-time.htm



--
Regards
Dave Hawley
www.ozgrid.com
"Eric" <Eric(a)discussions.microsoft.com> wrote in message
news:A6A6F8B2-6FB6-4E02-87F9-4F8D08626223(a)microsoft.com...
> Does anyone have any suggestions on how to set macro to run every 15
> minutes?
> Thanks in advance for any suggestions
> Eric

From: JLatham on
Stolen from a very nearby universe, er, answer to a question, and modified to
protect the guilty.

Option Explicit
Dim nextRunTime

Sub startRunning()
'you could put
' Run "MyCode"
'in the Workbook_Open() event
'
MyCode
End Sub

Sub stopRunning()
On Error Resume Next
Application.OnTime nextRunTime, "MyCode", , False
End Sub

Sub MyCode()
nextSecond = Now + TimeValue("00:15:00")
Application.OnTime nextSecond, "MyCode"

'your process to run right in with this stuff
'it has already set itself to run again in 15 minutes
End Sub


"Eric" wrote:

> Does anyone have any suggestions on how to set macro to run every 15 minutes?
> Thanks in advance for any suggestions
> Eric
From: Dave Peterson on
Chip Pearson's site explains it:
http://www.cpearson.com/excel/OnTime.aspx

Eric wrote:
>
> Does anyone have any suggestions on how to set macro to run every 15 minutes?
> Thanks in advance for any suggestions
> Eric

--

Dave Peterson
From: Eric on
For using Application.OnTime, do I need to close the excel application in
order to stop the process? It seems to me when the file is closed without
quiting the excel application, it will keep running the macro again.
Does anyone have any suggestions?
Thank everyone very much for any suggestions
Eric

"JLatham" wrote:

> Stolen from a very nearby universe, er, answer to a question, and modified to
> protect the guilty.
>
> Option Explicit
> Dim nextRunTime
>
> Sub startRunning()
> 'you could put
> ' Run "MyCode"
> 'in the Workbook_Open() event
> '
> MyCode
> End Sub
>
> Sub stopRunning()
> On Error Resume Next
> Application.OnTime nextRunTime, "MyCode", , False
> End Sub
>
> Sub MyCode()
> nextSecond = Now + TimeValue("00:15:00")
> Application.OnTime nextSecond, "MyCode"
>
> 'your process to run right in with this stuff
> 'it has already set itself to run again in 15 minutes
> End Sub
>
>
> "Eric" wrote:
>
> > Does anyone have any suggestions on how to set macro to run every 15 minutes?
> > Thanks in advance for any suggestions
> > Eric