lijon
09-14-2010, 10:49 AM
Help! ...I've borrowed from other sources and can feel I'm close ...but can't make this macro work.
I know the opening event triggers "starttimer" because the word 'Loaded' appears ...but the "refresher" macro doesn't run for some reason.
Am I messing up somewhere? Maybe in the declaration? Pls Help!
...in ThisWkbk
Private Sub workbook_open()
Call starttimer
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Call stoptimer
End Sub
...in Module 1:
Public Const cRunWhat = "refresher"
Sub starttimer()
Windows("myfile.XLS").Activate
Sheets("GDR").Select
Range("A2").Value = "loaded"
Application.OnTime TimeSerial(13, 38, 0), cRunWhat, True
End Sub
Sub stoptimer()
On Error Resume Next
Application.OnTime RunWhen, cRunWhat, False
End Sub
Sub refresher()
Range("A3").Value = "done"
Windows("myfile.XLS").Activate
Sheets("GDR").Select
Range("d5:e15").Select
Application.Run "RefreshCurrentSelection"
Range("A4").Value = "done2"
End Sub
Thanks,
L
I know the opening event triggers "starttimer" because the word 'Loaded' appears ...but the "refresher" macro doesn't run for some reason.
Am I messing up somewhere? Maybe in the declaration? Pls Help!
...in ThisWkbk
Private Sub workbook_open()
Call starttimer
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Call stoptimer
End Sub
...in Module 1:
Public Const cRunWhat = "refresher"
Sub starttimer()
Windows("myfile.XLS").Activate
Sheets("GDR").Select
Range("A2").Value = "loaded"
Application.OnTime TimeSerial(13, 38, 0), cRunWhat, True
End Sub
Sub stoptimer()
On Error Resume Next
Application.OnTime RunWhen, cRunWhat, False
End Sub
Sub refresher()
Range("A3").Value = "done"
Windows("myfile.XLS").Activate
Sheets("GDR").Select
Range("d5:e15").Select
Application.Run "RefreshCurrentSelection"
Range("A4").Value = "done2"
End Sub
Thanks,
L