Thread: Auto Refresh
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
AFSSkier AFSSkier is offline
external usenet poster
 
Posts: 94
Default Auto Refresh

George,

Put this code in your sub: ThisWorkbook.RefreshAll (see below)

Private Sub Workbook_BeforeClose(Cancel As Boolean)

Application.OnTime dTime, "MyMacro", , False

End Sub

Private Sub Workbook_Open()

Application.OnTime Now + TimeValue("00:00:15"), "MyMacro" 'test time set
to 15 sec

End Sub
'Place the following in any Standard Module (InsertModule)
Public dTime As Date
Sub MyMacro()
dTime = Now + TimeValue("00:00:15")
Application.OnTime dTime, "MyMacro"

ThisWorkbook.RefreshAll

MsgBox "Hooray my code works! All sheets are Refreshed"

End Sub

--
Kevin


"George" wrote:

Thanks that works - but the only thing I could find that I think
is refreshing the screen is the Save function, everything else gives
me an error message.

George

"AFSSkier" wrote:

This may help you.
http://www.ozgrid.com/Excel/run-macro-on-time.htm

--

"George" wrote:

I am using a shared Excel 2007 spreadsheet on a work LAN. Is there some code
I can add to it to have it auto refresh at a preset interval.