Thread: Expert Required
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
ceemo[_75_] ceemo[_75_] is offline
external usenet poster
 
Posts: 1
Default Expert Required


I have a workbook containing 5 imported tables that i want to refresh
every hour at 20 minutes past the hour.

The below code will only refresh them once at 20 minutes past.


Plese can you help me adapt this code to keep refreshing tem every hour
at 20 past?




Option Explicit

Dim dNext As Date

Sub Auto_Open()

dNext = TimeSerial(Hour(Now) + IIf(Minute(Now) < 20, 0, 1), 20, 0)
Application.OnTime dNext, "refreshdata"
Workbooks(ActiveWorkbook.Name).RefreshAll
End Sub

Sub refreshdata()
dNext = TimeSerial(Hour(dNext) + 1, 20, 0)
Application.OnTime dNext, "refreshdata"
Workbooks(ActiveWorkbook.Name).RefreshAll
End Sub

Sub cancelTimer()
Application.OnTime dNext, "refreshdata", , False
End Sub
Edit/Delete Message


--
ceemo
------------------------------------------------------------------------
ceemo's Profile: http://www.excelforum.com/member.php...o&userid=10650
View this thread: http://www.excelforum.com/showthread...hreadid=553758