Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
"Kicking Out" Inactive users 2
In reference to this macro below (which is great by the awy) i can get it to
work, but it closes the spreadsheet regardless of activity after the time limit. I have the code as it appears below in these threads, any ideas? ------------------------------------ Mike, just tested and it works for me, try taking out the lines ThisWorkbook.Save ThisWorkbook.Close and replacing with this ThisWorkbook.Close True -- Paul B Always backup your data before trying something new Please post any response to the newsgroups so others can benefit from it Feedback on answers is always appreciated! Using Excel 2002 & 2003 "Mike The Newb" wrote in message ... Paul - almost there! Paul - almost there. The code works great up until ThisWorkbook.Close and I get a "code interrupted" pop up; when I choose Debug it highlights the ThisWorkbook.Close and if I hit continue it runs its course and closes the file. Oddly, it does close itself, without any issues, if I am not in an Excel window watching it do its thing. Dim DownTime As Date Sub SetTime() DownTime = Now + TimeValue("00:00:20") Application.OnTime DownTime, "ShutDown" End Sub Sub ShutDown() ThisWorkbook.Save ThisWorkbook.Close End Sub Sub Disable() On Error Resume Next Application.OnTime EarliestTime:=DownTime, Procedu="ShutDown", Schedule:=False End Sub Regards, Mike "Paul B" wrote: Mike, click on your workbook on the left side, go up to insert ,module put that code in there, you should see the thisworkbook module, you may also what to have a look here on getting started with macros http://www.mvps.org/dmcritchie/excel/getstarted.htm -- Paul B Always backup your data before trying something new Please post any response to the newsgroups so others can benefit from it Feedback on answers is always appreciated! Using Excel 2002 & 2003 "Mike The Newb" wrote in message ... Paul - the code looks usable enough but I don't see a Standard Module. I can find the Workbook but I only see Modules 1-10 in the VBE windows on the left side of the screen in one existing file and a newly created file shows no Modules listed at all. What is the Standard Module and where can I find it? Just a Newb like the nickname implies. Thank you for your insight and patience. Regards, Mike "Paul B" wrote: Mike, not sure where I got this code but this should get you started this will auto-close the workbook after 20 seconds of inactivity '*************************************** 'put this in a standard module Dim DownTime As Date Sub SetTime() DownTime = Now + TimeValue("00:00:20") Application.OnTime DownTime, "ShutDown" End Sub Sub ShutDown() ThisWorkbook.Save ThisWorkbook.Close End Sub Sub Disable() On Error Resume Next Application.OnTime EarliestTime:=DownTime, Procedu="ShutDown", Schedule:=False End Sub '******************************************* '************************************ 'put this in thisworkbook Private Sub Workbook_Open() MsgBox "This workbook will auto-close after 20 seconds of inactivity" Call SetTime End Sub Private Sub Workbook_BeforeClose(Cancel As Boolean) Call Disable End Sub Private Sub Workbook_SheetCalculate(ByVal Sh As Object) Call Disable Call SetTime End Sub Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Excel.Range) Call Disable Call SetTime End Sub '***************************** -- Paul B Always backup your data before trying something new Please post any response to the newsgroups so others can benefit from it Feedback on answers is always appreciated! Using Excel 2002 & 2003 "Mike The Newb" wrote in message ... I have a file that only allows one user at a time to have write/update authority (first one in locks it up); there are five people with this modification authority. The problem is one of them opening it and then walking away for an extended period of time and thus the others cannot input their updates. I do not want to make it into a shared file. Similar to my company's auto password protected screen saver (kicks on after "x" number of inactive minutes), I would to have the file save itself and close if a write/update user hasn't navigated in the file via keyboard or mouse in say the last three minutes. Ideally, anyone who opened the file with "read only" clearance (approximately a dozen users preset as Read Only) would not get "kicked out" as they are not disrupting anyone. Any clues / insight? Regards, Mike Was this post helpful to you? 1 out of 1 people found this post helpful. Expand AllCollapse All Manage Your Profile |Contact us © 2006 Microsoft Corporation. All rights reserved. Terms of Use |Trademarks |Privacy Statement |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
"Kicking Out" Inactive Users | Excel Discussion (Misc queries) | |||
Kicking Out Selective (Not all) Inactive Users | Excel Discussion (Misc queries) | |||
Protect Workbook vs Worksheet?? | Excel Worksheet Functions | |||
How many users can sucessfully use a shared excel workbook? | Excel Worksheet Functions | |||
Protecting Workbook | Excel Discussion (Misc queries) |