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: 26
Default Stop vbTimer

Hello Everybody,

I have copied a code for a timer in a post and applied it to my workbook to
automatically show a userform after a short period of time.
My big problem is that when I close the workbook without quitting Excel the
timer continue running and re-open my workbook after the preset period to
show the userform again.
Is there a way to have the timer stopped when closing the workbook?

My code bellow:

In Module:

Option Explicit

Public nSaveWB As Date

Public Sub SetSaveWBTimer()
nSaveWB = Now + TimeSerial(0, 0, 5) ' 5 minutes
Application.OnTime nSaveWB, "SaveWB"
End Sub

Public Sub SaveWB()
Alerte.Show
End Sub


In ThisWorkbook:

Private Sub workbook_open()
Alerte.Show
End Sub


In Userform: (called Alerte)

Private Sub CommandButton1_Click()
Alerte.Hide
Call SetSaveWBTimer
End Sub

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = vbFormControlMenu Then
Call SetSaveWBTimer
End If
End Sub


Thanks for your help.
--

Regards, Cajeto 63.



 
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
How stop the "started office live" pop-up to stop. it is checked yrose24 Excel Discussion (Misc queries) 1 September 2nd 09 03:32 PM
To Stop or Not to Stop BillCPA Excel Discussion (Misc queries) 0 June 22nd 06 03:41 PM
How do I stop other circles in other cells to stop selecting? stauff Excel Worksheet Functions 2 October 29th 04 09:02 PM
How do I stop other circles in other boxes to stop selecting? stauff Excel Worksheet Functions 1 October 28th 04 10:27 PM
Macro: With Stop it works. Without Stop it doesn't. Don Wiss Excel Programming 2 October 12th 04 10:49 AM


All times are GMT +1. The time now is 04:37 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"