close (and save) workbook after ten minutes of nil activity

mnmhenry

Board Regular
Joined
Mar 28, 2002
Messages
167
Is it possible to close and save workbook after ten minutes of nil activity.

Some collegues regularly use some of my worksheets over a lan and are always leaving the files open whilst they are away from their desk (thus I cant open my own files). I'm sure most of us are familliar with this broblem.

Can this be done or can someone come up with a work around the problem ?

Thanks,
Mark.
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

agihcam

Well-known Member
Joined
Jan 16, 2006
Messages
1,624
try this codes;

place this code in a standard module;
Code:
Dim timelimit, go, endtime, timeclose
Sub limitme()
timelimit = 600
    go = Timer
    Do While Timer < go + timelimit
        DoEvents
    Loop
    endtime = Timer
    timeclose = endtime - go
    ThisWorkbook.Close True
End Sub

place this code in thisworkbook module;
Code:
Private Sub Workbook_Open()
limitme
End Sub
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
timelimit = 0    ' Set duration.
    limitme
End Sub

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
timelimit = 0    ' Set duration.
    limitme
End Sub
 

Forum statistics

Threads
1,144,158
Messages
5,722,827
Members
422,460
Latest member
VBA_Noob01

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top