set timer for a excel spread sheet using a variable for the time value
trying to start a sheet update routine with the timer using a variable. see code below, when I use the hard code that works but not working when using a variable, it doesn't start the timer, perhaps a different way to start the timer?
Public Sub startTimer()
'... the following is the procedure to run on the timer'
saveRTDinfo 'Sub saveRTDinfo()
alertTime = alertTime 'for debugging to view value
alertTime = now + TimeValue(alertTime) 'doesn't work see next line
'debug.print "alertTime = " & alertTime, this prints 00:02:00, literally, without parens
alertTime = now + TimeValue("00:02:00") 'this works
Application.OnTime EarliestTime:=alertTime, _
Procedure:="startTimer", schedule:=True
End Sub
here's the variable definitions
Public alertTime As Variant
Public alertTimeHH As String
Public alertTimeMM As String
Public alertTimeSS As String
Re: set timer for a excel spread sheet using a variable for the time value
This is not VB.NET code. Thread moved to Office Development forum, which is where VBA questions belong. Even VB.NET code that is Office-specific can be posted in Office Development.
Re: set timer for a excel spread sheet using a variable for the time value
TimeValue expects a (quoted?) Time-String
Last edited by Zvoni; Tomorrow at 31:69 PM.
----------------------------------------------------------------------------------------
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------------------
People call me crazy because i'm jumping out of perfectly fine airplanes.
---------------------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad