Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Can anyone point me to a reference for coding an idle timer? I have a
submission tool that multiple users access that I want to put an idle timer on so that after a certain amount of time it gives a warning and to long and it automatically closes the workbook. Jesse |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
see Chip Pearson's page on using Ontime
http://www.cpearson.com/excel/ontime.htm you could combine this with a selectionchange event to cancel the currently scheduled event and schedule a new one. http://www.cpearson.com/excel/events.htm if you are not familiar with events. -- Regards, Tom Ogilvy "Jesse" wrote: Can anyone point me to a reference for coding an idle timer? I have a submission tool that multiple users access that I want to put an idle timer on so that after a certain amount of time it gives a warning and to long and it automatically closes the workbook. Jesse |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Tom, that will work perfectly.
Jesse |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Thu, 6 Apr 2006 12:10:02 -0700, Tom Ogilvy
wrote: see Chip Pearson's page on using Ontime http://www.cpearson.com/excel/ontime.htm you could combine this with a selectionchange event to cancel the currently scheduled event and schedule a new one. http://www.cpearson.com/excel/events.htm if you are not familiar with events. I found this helpful too, thanks. I would like to take this in a slightly different direction and detect when a user is no longer idle. I thought I had the answer by using the above, to wit: Workbook_Open() contains: Option Explicit Option Base 1 Dim AppClass As New EventClass Private Sub Workbook_Open() Set AppClass.App = Application End Sub and I have a Class Module named "EventClass" with things like this in it: Option Explicit Public WithEvents App As Application Private Sub App_NewWorkbook(ByVal Wb As Excel.Workbook) MsgBox "NewWorkbook: " & Wb.Name bStopFetchingFlag = True 'If we're fetching, this stops us after the current one SetNewTimer End Sub Private Sub App_SheetActivate(ByVal Sh As Object) MsgBox "Sheet Activated: " & Sh.Name bStopFetchingFlag = True SetNewTimer End Sub and then another module containing: Sub SetNewTimer() ResetTimer 'Cancel any existing timer before starting a new one 'adjust the time below to your needs, this is 30 minutes dNextTime = Now + TimeValue("00:30:00") Application.OnTime dNextTime, "DoThings" End Sub Sub ResetTimer() Application.OnTime dNextTime, "DoThings", False End Sub Sub DoThings() Dim i As Long For i = 1 To 100000 DoEvents If bStopFetchingFlag Then MsgBox "We were stopped!" End If Next i End Sub The trouble is, once "DoThings" starts, the bStopFetchingFlag variable never becomes true, even though I add sheets, activate sheets, change sheets, etc. - all the events I trap for in EventClass. Obviously, DoThings above is just a testing routine - the one I actually want to use is much more complicated, but I want to stop it (while remembering how far it got), in case the user comes back and wants to do some other Excel work. My stuff would be packaged in an add-in. Many things for any help anyone can provide. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
I would like a range of cells to become blank if they are idle for | Excel Discussion (Misc queries) | |||
detecting idle time | Excel Discussion (Misc queries) | |||
TImeIn-TimeOut-TimeIn-TimeOut-HoursWorked | Excel Worksheet Functions | |||
Detecting user idle time | Excel Programming | |||
API call to check other program is idle | Excel Programming |