LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default OnTime method

I'm trying to use the OnTime method to continually execute a macro every so
often. The problem I am having now is that after I close out of the
workbook, the OnTime method executes the specified procedure after a period
of time and Excel automatically opens the file back up. I've tried using a
BeforeClose event along with another OnTime method to clear the procedure,
but it's giving me a run-time error saying "Method 'OnTime" of object
'_Application' failed.

Is there another method I can use to cycle through the procedure
periodically that will not execute once I've close the workbook? Or is there
a way to clear the procedure using a BeforeClose event? Perhaps there may
even be a way to correct the code I am using that is giving me the error.
Code below appearing in the ThisWorkbook object. Thanks.

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.OnTime Now + TimeValue("00:00:01"), "killTimer", , False
End Sub

Sub killTimer()
ThisWorkbook.Save
End Sub

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
ontime method? max Excel Programming 8 February 8th 05 09:04 PM
ontime method? max Excel Programming 2 February 7th 05 03:25 PM
ontime Method Bill Krone Excel Programming 1 August 12th 04 04:30 PM
Help me with OnTime Method dolegow Excel Programming 1 October 12th 03 01:52 AM
OnTime method only runs 1 time JP[_7_] Excel Programming 2 August 15th 03 09:27 AM


All times are GMT +1. The time now is 03:47 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"