Cycle Number Lock
Once it's turned the numlock on, I wouldn't think that code would do
anything next time you call it.
However, it wouldn't take much to turn it into a toggle.
Once you've got that, you can use Application.OnTime to call your sub
something like this:
Dim timTime As Date
Sub UPDATE()
Application.OnTime Now + TimeValue("00:10:00"), "startTimer"
'
' Do other stuff
'
stopTimer
End Sub
Sub startTimer()
ChangeState
timTime = Now + TimeValue("00:10:00")
Application.OnTime timTime, "startTimer"
End Sub
Sub stopTimer()
Application.OnTime timTime, "startTimer", , False
End Sub
Timmothy Gransbury wrote:
I have managed to find something that fixes a previous problem that I posted. I was trying to prevent the "inactivity logout" feature of our network while my code ran (it can take up to about 45 minutes). The code below is what I use, it toggles the "Number Lock Key" on and off. The question I have now is, I would prefer not to have to put this throughout the entire code (some 300 sheets). I would like to make it so that this code runs at a reqular interval, say every 10 minutes. I have tried some things that people have posted for "auto close" features, but nothing works. I don't want to to run when the workbook is open in general but only when the "UPDATE" code is ran (usually the first of every month). This code updates approx 300 files into other workbooks, creating some, and adding to others, it has many modules and probably over 100 macros all tied together with one main macro called "UPDATE". Sorry I am getting confusing.
Basically whenever the macro "UPDATE" is ran I need something to run in the background and every 10 minutes run the code below.
Thanks for your help on this, all of this is kinda new stuff for me, and least new uses for VBA.
<snip
|