#1   Report Post  
Posted to microsoft.public.excel.misc
 
Posts: n/a
Default OnTime VB

I want to refresh my data every day at 12am. Does something like this
make sence?

Public RunWhen As Double

Sub StartTimer()

RunWhen = Time() = #12:00:00 AM# + TimeSerial(24, 0, 0)
Application.OnTime earliesttime:=RunWhen, procedu="The_Sub", _
schedule:=True
End Sub

Sub The_Sub()


ActiveWorkbook.RefreshAll
StartTimer

End Sub

  #2   Report Post  
Posted to microsoft.public.excel.misc
Ardus Petus
 
Posts: n/a
Default OnTime VB

Sub StartTimer()
Dim RunWhen As Double
RunWhen = Time() = #12:00:00 AM# + TimeSerial(24, 0, 0)
Application.OnTime earliesttime:=RunWhen, procedu="The_Sub", _
schedule:=True
End Sub

HTH
--
AP

a écrit dans le message de news:
...
I want to refresh my data every day at 12am. Does something like this
make sence?

Public RunWhen As Double

Sub StartTimer()

RunWhen = Time() = #12:00:00 AM# + TimeSerial(24, 0, 0)
Application.OnTime earliesttime:=RunWhen, procedu="The_Sub", _
schedule:=True
End Sub

Sub The_Sub()


ActiveWorkbook.RefreshAll
StartTimer

End Sub



  #3   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default OnTime VB

This looks funny to me:

RunWhen = Time() = #12:00:00 AM# + TimeSerial(24, 0, 0)

Maybe:

RunWhen = date + TimeSerial(23, 59, 59)
or
RunWhen = date + 1

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


wrote:

I want to refresh my data every day at 12am. Does something like this
make sence?

Public RunWhen As Double

Sub StartTimer()

RunWhen = Time() = #12:00:00 AM# + TimeSerial(24, 0, 0)
Application.OnTime earliesttime:=RunWhen, procedu="The_Sub", _
schedule:=True
End Sub

Sub The_Sub()

ActiveWorkbook.RefreshAll
StartTimer

End Sub


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.misc
 
Posts: n/a
Default OnTime VB

now with something like RunWhen = date + TimeSerial(23, 59, 59)
would that automatically refresh every day- or would it just do that
one day?

  #5   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default OnTime VB

It would only do it once.

But you could have your code set up the next time right after that time
finishes.

Chip shows you how at that link.

wrote:

now with something like RunWhen = date + TimeSerial(23, 59, 59)
would that automatically refresh every day- or would it just do that
one day?


--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.misc
Chip Pearson
 
Posts: n/a
Default OnTime VB

It would run only once. See www.cpearson.com/excel/ontime.htm

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


wrote in message
ups.com...
now with something like RunWhen = date + TimeSerial(23, 59, 59)
would that automatically refresh every day- or would it just do
that
one day?



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
Can someone explain OnTime? hw Excel Discussion (Misc queries) 1 May 4th 05 05:04 PM
Excel 2003 / Windows XP Pulsating Excel screen !! monir Excel Discussion (Misc queries) 9 February 7th 05 10:50 PM


All times are GMT +1. The time now is 08:47 AM.

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"