![]() |
Automating Refreshing Part (III)
Good afternoon,
I do apologize for the later reply, but I just came to work. :-) While I was test running the langauge, again, the password box is fine, yes. It is when it is trying to call the timer to start that it doesn't actually start. To clarify, when the spreadsheet opens, it never refreshes, even with the togglebutton1 value being true. Now when I push the button it does ask for the password and I'd assume it stops the timer since the button action is false. When I repush the button to start the refresh, it doesn't start the timer and I haven't figured out what is needed to start the timer from the code that is there. I wish I could email you the example, but our email is heavily restricted to only people inside the company (I am not IT persay, I'm a floor person doing this work as requested). Any help is definately appreciated. :-) This is the code that currently works (asks for password): Public RunWhen As Double Public Const cRunIntervalSeconds = 60 ' Thirty minutes Public Const CRunWhat = "Refresher" ' name of procedure to run Private Sub ToggleButton1_Click() Dim x As String, pword As String pword = "test" x = InputBoxDK("Type your password here.", "Password Required", "") If x = pword Then 'Change caption on Toggle button ToggleButton1.Value = False ToggleButton1.Caption = "Refresh Disabled" 'Stop Timer from running again StopTimer Else 'Change caption on Toggle button ToggleButton1.Value = True ToggleButton1.Caption = "Refresh Enabled" 'Call StartTimer Sub to begin refreshing StartTimer ' Notify User MsgBox "You didn't enter the correct password to turn off the refresher." End If End Sub Sub StopTimer() On Error Resume Next Application.OnTime EarliestTime:=RunWhen, Procedu=CRunWhat, Schedule:=False End Sub Sub Refresher() 'Makes the entire Workbook Refresh ThisWorkbook.RefreshAll StartTimer End Sub Sub StartTimer() RunWhen = Now + TimeSerial(0, 0, cRunIntervalSeconds) Application.OnTime EarliestTime:=RunWhen, Procedu=CRunWhat, Schedule:=True End Sub Jessica |
All times are GMT +1. The time now is 11:56 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com