![]() |
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 |
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 |
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 |
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? |
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 |
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? |
All times are GMT +1. The time now is 08:30 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com