Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Application.Ontime for Private Sub(Proceedure) - ThisWorkbook*

Hi All,

Can anyone help me for the below query:
I want to pop up a msgbox in every 1 minute(executing the same
proceedure when workbook open, but it should continue after every
minute)

eg:

Private Sub msg_box()
msgbox "Please close the file"
Application.OnTime Now + TimeValue("00:00:0"), "msg_box" 'here I am
not able to use this proceedure
End Sub

In module we can use this, but without calling the proceedure from
module how can I run this from Private Sub itself?

Thanks a lot in advance
Ratheesh
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Application.Ontime for Private Sub(Proceedure) - ThisWorkbook*

Hi Ratheesh,

Below is code I use to run Ontime. It inturn calls another sub,
"QuerySheets" which updates my spreadsheets.

Martin


Public Sub OnTrack() 'sets time and does the OnTime thing
Dim oldAppScreenUpdate As Boolean
Dim RunWhen As Date
Dim RunWhat As String
On Error Resume Next
If Not SetFlag Then 'flag is to prevent repetitions
With Application
oldAppScreenUpdate = .ScreenUpdating
.ScreenUpdating = False
RunWhen = TimeSerial(Hour(Time), Minute(Time) + 1, 0)
RunWhat = "QuerySheets"
.OnTime earliesttime:=RunWhen, procedu=RunWhat, _
schedule:=True
SetFlag = True
.ScreenUpdating = oldAppScreenUpdate
End With
End If
End Sub

"Ratheesh" wrote in message
...
Hi All,

Can anyone help me for the below query:
I want to pop up a msgbox in every 1 minute(executing the same
proceedure when workbook open, but it should continue after every
minute)

eg:

Private Sub msg_box()
msgbox "Please close the file"
Application.OnTime Now + TimeValue("00:00:0"), "msg_box" 'here I am
not able to use this proceedure
End Sub

In module we can use this, but without calling the proceedure from
module how can I run this from Private Sub itself?

Thanks a lot in advance
Ratheesh



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Application.Ontime for Private Sub(Proceedure) - ThisWorkbook*

On Aug 7, 9:15*am, "Martin Wheer" wrote:
Hi Ratheesh,

Below is code I use to run Ontime. *It inturn calls another sub,
"QuerySheets" *which updates my spreadsheets.

Martin

Public Sub OnTrack() * *'sets time and does the OnTime thing
* * Dim oldAppScreenUpdate As Boolean
* * Dim RunWhen As Date
* * Dim RunWhat As String
* * On Error Resume Next
* * If Not SetFlag Then 'flag is to prevent repetitions
* * * * With Application
* * * * * * oldAppScreenUpdate = .ScreenUpdating
* * * * * * .ScreenUpdating = False
* * * * * * RunWhen = TimeSerial(Hour(Time), Minute(Time) + 1, 0)
* * * * * * RunWhat = "QuerySheets"
* * * * * * .OnTime earliesttime:=RunWhen, procedu=RunWhat, _
* * * * * * * * schedule:=True
* * * * * * SetFlag = True
* * * * * * .ScreenUpdating = oldAppScreenUpdate
* * * * End With
* * End If
End Sub

"Ratheesh" wrote in message

...



Hi All,


Can anyone help me for the below query:
I want to pop up a msgbox in every 1 minute(executing the same
proceedure when workbook open, but it should continue after every
minute)


eg:


Private Sub msg_box()
msgbox "Please close the file"
Application.OnTime Now + TimeValue("00:00:0"), "msg_box" *'here I am
not able to use this proceedure
End Sub


In module we can use this, but without calling the proceedure from
module how can I run this from Private Sub itself?


Thanks a lot in advance
Ratheesh- Hide quoted text -


- Show quoted text -


Hi Martin,

Thanks a lot for your help...
Actually I got some more things from your code than what I really
asked for...

Cheers
Ratheesh
Reply
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
Using application.ontime J.W. Aldridge Excel Programming 1 October 26th 07 10:38 PM
Help with Application.OnTime [email protected] Excel Programming 1 April 3rd 06 06:02 PM
Clarification on "Application.Worbooks.Count" proceedure Les Stout[_2_] Excel Programming 8 November 2nd 05 07:12 PM
Application.OnTIme Mike Excel Programming 8 September 15th 04 03:27 PM
Call Private Function from ThisWorkbook module Beto[_3_] Excel Programming 3 February 25th 04 01:36 PM


All times are GMT +1. The time now is 10:05 PM.

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

About Us

"It's about Microsoft Excel"