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

mnmhenry

Board Regular
Joined
Mar 28, 2002
Messages
169
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

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
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
 
Upvote 0

Forum statistics

Threads
1,214,996
Messages
6,122,636
Members
449,092
Latest member
bsb1122

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
Back
Top