ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Is there a way to interrupt "Ontime" macro once it is started? (https://www.excelbanter.com/excel-programming/372227-there-way-interrupt-ontime-macro-once-started.html)

Carl

Is there a way to interrupt "Ontime" macro once it is started?
 
I have a macro that saves the workbook 30 minutes after opening using
"OnTime". Is there a way to stop this once it has started? I know one way is
to close and reopen the workbook and Excel but is there a way to do it
without having to close the workbook? Thanks in advance.

Jim Thomlinson

Is there a way to interrupt "Ontime" macro once it is started?
 
Nope... the best you will do is to pop a mesage for the user warning them of
the save...

if msgbox("Do you wanna save???", vbyesno) = vbyes then thisworkbook.save
--
HTH...

Jim Thomlinson


"Carl" wrote:

I have a macro that saves the workbook 30 minutes after opening using
"OnTime". Is there a way to stop this once it has started? I know one way is
to close and reopen the workbook and Excel but is there a way to do it
without having to close the workbook? Thanks in advance.


Carl

Is there a way to interrupt "Ontime" macro once it is started?
 
Thanks, Jim. I was afraid this would be the case.

"Jim Thomlinson" wrote:

Nope... the best you will do is to pop a mesage for the user warning them of
the save...

if msgbox("Do you wanna save???", vbyesno) = vbyes then thisworkbook.save
--
HTH...

Jim Thomlinson


"Carl" wrote:

I have a macro that saves the workbook 30 minutes after opening using
"OnTime". Is there a way to stop this once it has started? I know one way is
to close and reopen the workbook and Excel but is there a way to do it
without having to close the workbook? Thanks in advance.


Peter T

Is there a way to interrupt "Ontime" macro once it is started?
 
If you mean abort a scheduled Ontime before it's occurred, store the
'EarliestTime' and set the optional Schedule to false, eg

Sub myOnTime(bRun As Boolean)
Static tme As Date ' or at module level
If bRun Then
tme = Now + TimeSerial(0, 0, 5) ' 5 sec's from now
End If
Application.OnTime tme, "myMacro", schedule:=bRun

End Sub

Regards,
Peter T


"Carl" wrote in message
...
Thanks, Jim. I was afraid this would be the case.

"Jim Thomlinson" wrote:

Nope... the best you will do is to pop a mesage for the user warning

them of
the save...

if msgbox("Do you wanna save???", vbyesno) = vbyes then

thisworkbook.save
--
HTH...

Jim Thomlinson


"Carl" wrote:

I have a macro that saves the workbook 30 minutes after opening using
"OnTime". Is there a way to stop this once it has started? I know one

way is
to close and reopen the workbook and Excel but is there a way to do it
without having to close the workbook? Thanks in advance.




Jim Cone

Is there a way to interrupt "Ontime" macro once it is started?
 
Well, maybe...
http://www.cpearson.com/excel/ontime.htm
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"Carl"

wrote in message
Thanks, Jim. I was afraid this would be the case.


"Jim Thomlinson" wrote:
Nope... the best you will do is to pop a mesage for the user warning them of
the save...
if msgbox("Do you wanna save???", vbyesno) = vbyes then thisworkbook.save
HTH...
Jim Thomlinson





"Carl" wrote:
I have a macro that saves the workbook 30 minutes after opening using
"OnTime". Is there a way to stop this once it has started? I know one way is
to close and reopen the workbook and Excel but is there a way to do it
without having to close the workbook? Thanks in advance.


Dave Peterson

Is there a way to interrupt "Ontime" macro once it is started?
 
Chip Pearson has lots of instructions at:
http://www.cpearson.com/excel/ontime.htm

Carl wrote:

I have a macro that saves the workbook 30 minutes after opening using
"OnTime". Is there a way to stop this once it has started? I know one way is
to close and reopen the workbook and Excel but is there a way to do it
without having to close the workbook? Thanks in advance.


--

Dave Peterson

Carl

Is there a way to interrupt "Ontime" macro once it is started?
 
Thanks to all for the great information!

"Dave Peterson" wrote:

Chip Pearson has lots of instructions at:
http://www.cpearson.com/excel/ontime.htm

Carl wrote:

I have a macro that saves the workbook 30 minutes after opening using
"OnTime". Is there a way to stop this once it has started? I know one way is
to close and reopen the workbook and Excel but is there a way to do it
without having to close the workbook? Thanks in advance.


--

Dave Peterson



All times are GMT +1. The time now is 06:07 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com