Automatically Close If A User Is Inactive For A Period Of Time.
Nov 13, 2008
We have one shared excel workbook and it is used by many people (more than 20 simultaneously), is there any way to auto save & close the workbook (session) if a user is inactive for specified time.
I have the following code in a simple userform containing only a label:
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub UserForm_Activate() DoEvents Sleep 4000 Unload Me End Sub
When I invoke this as a single macro in a blank workbook and immediately change focus by pressing ALT+TAB to enter NotePad the userform is shown and exits normally after 4 seconds.
However, when I issue this code from within a larger macro, and hit ALT+TAB to Notepad, the excel application hangs on the displayed userform until I click back into Excel.
If required, I can happily send you the code as an attachment.
I have a protected worksheet. Users wish to be able to track changes in the input cells. The suggested approach for this is to temporarily disable sheet protection and allow them to change the font color, then protect afterwards. What I would like to do is:
i) check whether they are in an input cell ii) if so, then prompt the user with the 'Font Color' dialog box iii) apply the font color selected to the input cell
I'm struggling to find the dialog box I need. I can launch the one to change the interior color, no problem (Application.Dialogs(xlDialogPatterns).Show). But that's no use to me, I just want a color palette that specifically relates to the Font Color
I tried to use Workbooks("Inactivebookname.xlsm").Close False and many variations thereof, but I simply cannot close this workbook when currently another workbook is active.
I have no problem in closing an active workbook with ActiveWorkbook.Close
I have got a spreadsheet which is being used as a database. I would like the spreadsheet to close automatically if the user has not "touched" it for a specific amount of time (say 1hr).
2 scenarios:
a/ The user is working in Excel but with another workbook. b/ The user has the excel spreadsheet open but is working with another application, say Word
I experimented with Workbook_WindowDeactivate but I do not know how to stop the process if the Workbook is reactivated (Maybe a DO ...LOOP calling a function returning a True/False statement on the event Workbook_WindowActivate !!). My way of thinking is the following
Workbook is deactivated Start a timer If the workbook is not reactivated with 1hr, save and close (no user intervention wanted) Else stop timer Repeat process
I have a workbook, "A", that while open I need to be able to detect any type of activity within other open Excel workbooks "B...Z" that are simultaneously open.
I understand that I would need to use the Class Module with a Public WithEvents function but I am stuck here.
I am creating a userform in Excel 2007 which requires a user to pick their name from a drop down box then press Ok, what i want to do is disable the Ok button until the user field has been selected.
I use the 'on time' function to kick users out of a shared workbook after 30 minutes of inactivity (i.e. no cells updated). Technically it works, as it does kick out the users.
However the time after which it does so seems to bear no relation to the time I have instructed. Sometimes shorter, sometimes longer! If it is was always longer, I would be happy that there is an error in my code somewhere (i.e. the time value is resetting on an unexpected event that I need to find and alter).
I have thousands of timestamps that have a start & end date and time in 2 separate columns. (one named start and one named end...)
I also have numerous set time periods that i'm interested in.. (about a dozen or so)
for example 01/01/2008 - 05/01/2008, 07:30:00 - 10:00:00
What i need is to be able to count the number of times the full time period i am interested (07:30:00 - 10:00:00) in falls in between the thousands of start and end timestamps i have. The time periods must also fall within the date range specifed.
So if my timestamps were Start: 01/01/2008 06:30:00 & End: 02/01/2008 11:00:00, based on the set time period above, there would be a count of 2
and if my timestamps were Start: 01/01/2008 07:05:00 & End: 02/01/2008 09:00:00 there would be a count of zero as there is not a full uninterupted timeperiod 07:00:00 - 10:00:00 between these timestamps.
and if my timestamps were: Start 01/01/2007 07:00:00 & End 02/01/2007 10:00:00 the count would be zer as this is a year early!
I want to return a value based on once off time related data which is captured at 4 time periods throughout a day. I have another set of data which does not line up with this data but I want it to return the value closest earliest value.
Given this data: 27-6-14 3:00 12 27-6-14 7:00 18 27-6-14 11:00 19
If I have a time like 27-6-14 5:00 I want to return a value of 12 (Previous time). How would this be possible?
Calculate certain time increments for various work-shifts. I have a start time,finish time and increments of time across the spectrum of 24 hours. There are also multiple start time across the 24 hour period with some start times begining on one day and ending on the next day.
Example
In B5 Startime is 22:00 In C5 Finishtime is 06:30
In I3 increment begins at 00:00 In I4 increment ends at 00:30
The employee working the shift from 22:00 - 06:30 would fall into the time increment of 00:00 - 00:30 where another employee working a different shift (08:30 - 17:00) would not. I'm looking for a formula that would return a 1 in a cell if the employee fell into the 00:00 - 00:30 time increment and a 0 in a cell in the employee did not fall into the time increment.
I am trying to determine a formula to know a period time for example i started to test a unit at 10:20 am of 10/02/2011 and i would like to add 52 hours of test and i would like to know when and at what time will finish the test?
I have a project where I have to work out the value of cars over a period of time.
The cars depreciate at 36.9% per year over a 5 year period and I can't work out for the life of me how to create a formula in excel that give me the values at the end of each year.
Each car costs £10000 and I need to know what the value of each car is at the end of each year
I have sheet that is populated with data daily. I wish to create graphs from information contained within a table in this sheet where i can select the start date and end date of the graph possibly from a drop down menu. I will be creating multiple graphs and wish for them all to change when i select the time period.
I've searched a few of the posts here about freebies in terms of adding a trial period to your spreadsheet. I'm just starting to get into VBA programming (beginnner), but I was wondering if anyone here could suggest actual programs or add-ins that I could buy that would allow me to create a trial version of my spreadsheet? either by allowing the user to use it for a few days or to allow the user to use it for a specifed # of times.
I'm willing to pay for this, but I can't afford those expensive Licensing/Copy protection programs....I need a simple solution in between $20 and $60....
I want to assign a macro to a button that will unhide a tab for about 10 seconds, then rehide it and navigate to another tab. How do you do timed commands?
I have a in field column M of my table that gives the week number of various dates within the table.
I would like to find the high value reached during each week based on the Highs which are located in column P, the highs consist if workdays during each week number.
I would like this to appear as a new calculated field entitled "Week High", I am assuming I need to input a custom formula to do this. I also want to create calculated fields for the the high reached during each year, the year is in column L
I have an Access database, with a table of jobs processed.
One column for Job ID (Unique), Date it was processed, By Who it was processed and Comments ascoiated.
I need to chart a graph of Jobs over a period of time. How many jobs done per date. In excel preferebly, I have programs like Database Plus for excel. And I am familiar with VBA. I can't figure out how to uniquely sort how many jobs for each date. As there are numerous job entries for on the same dates. I think it can be done with an SQL query or sorting it with VBA somehow. Any help will be greatly appreciated. Or can anyone suggest an application designed for charting with Access databases in Excel?
compare two lists of data in order to identify the possible matches considering date&time and the location stored in different columns as shown in the example file attached. The range of date and time for the comparison is one hour, but it can be changed...
I am a flight instructor and legally we cannot work more than 8 hours in any consecutive 24 hour period. I'm trying to create a spreadsheet that will calculate the totals from that 24 hour period for me.
Right now I have something that sort of works, but not the way I would like it. I have a column for "time" that has the date and ending time of the flight and I am using that as if the total flight occurred at one moment (the ending time).
So, for instance let's say I did these flights
1: 8AM-10AM (2 hours, clocked at 10AM) 2: 11AM - 2 PM (2 hours, clocked at 2PM) 3: 7AM-9AM the following day (2 hours, clocked at 9AM)
If I have my formula calculate the time for 9AM the following day (totaling the past 24 hours) the first flight won't be included in the calculation since the hours from that flight is only imputed at 10AM. The formula would read 4 hours rather than the (actual) 5 hours.
Here is my workbook : 8 hour calculator sample.xlsx
Here are the formulas I am using
The time is formulated at date and time, with time being the ending flight time
The start time for the calculation is
[Code]....
end time is just =NOW()
Total calculation is
[Code] .....
All I'm trying to do is use the totals under "flight start" and "flight end" instead of the end flight time I had to put in under the date column.
I am creating a timesheet using excel 2003 users enter their shift start/finish time and a break start/finish time. Emplyee's can work night shifts (ie across midnight).
There are penalty rates which apply at different times. I need to be able to work out the amount of worked time that fits into a certain time period. eg. 10pm-7.30am, 7.30am-10pm.
I have a solution based on A clever formula from Daniel Maher that will calculate time within a period. But it doesn't work when the shift goes over two days.
I have attached a spreadsheet to help show the problem .......
I am trying to calculate the average start time for a machine over a period. However the machine start time varies from 10:00 pm to past midnight. I have tried reviewing past posts but cannot seem to find a similar query.
I'm opening a workbook and then running the macro in the workbook. The problem is I would like to build a "timeout" feature if the macro is running too long (as some of the macro's this will run can take days to complete) but I don't know how to run the macro asynchronously. Also I need to know if i can get it to run asynchronous is there an event that will tell me when the process is finished. The calling application of the macro is written in VB6 and opening excel workbooks to run the macros out of. also the "timeout" feature must be done from the VB6 application it cannot be edited into the the workbooks containing the macro.
how you can remove the close 'X' on the title bar of a user form please? I have used this for a password input box but if the user selects the 'X' on the title bar then it closes the password box without them having to enter a password and allows them into the workbook.
Assume that the workbook Book1.xls opens a user form named myUserForm.
I'm trying to show only the user form on the desktop when I open Book1.xls, with Book1.xls minimized on the Taskbar.
And , if the Cancel button on the form is clicked, then unload the form and close Book1.xls.
That simple!
In ThisWorkbook, I have the event:
Private Sub Workbook_Open() ActiveWindow.WindowState = xlMinimized ShowTheForm End Sub On the Form, I have the Cancel button:
Private Sub btnCancel_Click() Unload Me ThisWorkbook.Close True End Sub
The above procedure shows the form, with Microsoft Excel blank window in the background, and produces a small bar at the bottom left of the screen for Book1.xls Click the Cancel button, and both the Form and Book1.xls close, but the blank Excel window remain open !
I suppose I would not be able to edit this version of Book1.xls, but that is fine for now!