Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default inactive worksheet

Is there a way to have a pop up notice appear if a open workbook is open but
no information is being inputed or no cells are being activated or tabs being
selected?

Basically tell the current user to close the workbook due to inactivity.

I have a shared file that sometimes get's left open on someone computer and
that person moves on to other tasks without closing it.

Is this possible?
TIA
Peter
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default inactive worksheet

Hi,

here's a way
http://www.ozgrid.com/forum/showthread.php?t=42169

Mike

"Looping through" wrote:

Is there a way to have a pop up notice appear if a open workbook is open but
no information is being inputed or no cells are being activated or tabs being
selected?

Basically tell the current user to close the workbook due to inactivity.

I have a shared file that sometimes get's left open on someone computer and
that person moves on to other tasks without closing it.

Is this possible?
TIA
Peter

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,069
Default inactive worksheet

One way...

In the ThisWorkbook module of the workbook, paste the following code:

Private Sub Workbook_Open()
'Set StartTime when the workbook is opened.
StartTime = Timer
'Schedule a call to CheckTime in the future to check elapsed idle time.
Application.OnTime (Now + TimeValue(TimeCheckDelay)), "CheckTime"
End Sub

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target
As Range)
'Something changed in the workbook, so reset StartTime.
StartTime = Timer
End Sub

In A VBA code module in the same workbook, paste this code:

Global StartTime As Single
Global Const TimeLimitInMinutes = 180 'idle time threshold
Global Const TimeCheckDelay = "00:10:00"

Sub CheckTime()
Dim NewTime As Single
'Get the time (seconds past midnight) now.
NewTime = Timer
'If StartTime was yesterday, add 86400 seconds to NewTime.
If NewTime < StartTime Then
NewTime = NewTime + 86400
End If
'If TimeLimitInMinutes has expired since StartTime was last
'updated, close the workbook without saving changes.
If (NewTime - StartTime) (TimeLimitInMinutes * 60) Then
ThisWorkbook.Saved = True
ThisWorkbook.Close SaveChanges:=False
Else
'Otherwise, schedule a call to CheckTime in the future to check
'again later.
Application.OnTime (Now + TimeValue(TimeCheckDelay)), "CheckTime"
End If
End Sub

The code above is set to close the workbook without saving changes if it is
idle for more than 180 minutes (3 hours). It will check every 10 minutes.

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Hope this helps,

Hutch

"Looping through" wrote:

Is there a way to have a pop up notice appear if a open workbook is open but
no information is being inputed or no cells are being activated or tabs being
selected?

Basically tell the current user to close the workbook due to inactivity.

I have a shared file that sometimes get's left open on someone computer and
that person moves on to other tasks without closing it.

Is this possible?
TIA
Peter

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 550
Default inactive worksheet

Peter,

What if there's no one there to see the pop-up?

Why not use an inactivity timer and close it down automatically.
You can find some code for one he

http://tinyurl.com/5k2ydn

John

"Looping through" wrote in
message ...
Is there a way to have a pop up notice appear if a open workbook is open
but
no information is being inputed or no cells are being activated or tabs
being
selected?

Basically tell the current user to close the workbook due to inactivity.

I have a shared file that sometimes get's left open on someone computer
and
that person moves on to other tasks without closing it.

Is this possible?
TIA
Peter


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default inactive worksheet

You are awesome

"Tom Hutchins" wrote:

One way...

In the ThisWorkbook module of the workbook, paste the following code:

Private Sub Workbook_Open()
'Set StartTime when the workbook is opened.
StartTime = Timer
'Schedule a call to CheckTime in the future to check elapsed idle time.
Application.OnTime (Now + TimeValue(TimeCheckDelay)), "CheckTime"
End Sub

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target
As Range)
'Something changed in the workbook, so reset StartTime.
StartTime = Timer
End Sub

In A VBA code module in the same workbook, paste this code:

Global StartTime As Single
Global Const TimeLimitInMinutes = 180 'idle time threshold
Global Const TimeCheckDelay = "00:10:00"

Sub CheckTime()
Dim NewTime As Single
'Get the time (seconds past midnight) now.
NewTime = Timer
'If StartTime was yesterday, add 86400 seconds to NewTime.
If NewTime < StartTime Then
NewTime = NewTime + 86400
End If
'If TimeLimitInMinutes has expired since StartTime was last
'updated, close the workbook without saving changes.
If (NewTime - StartTime) (TimeLimitInMinutes * 60) Then
ThisWorkbook.Saved = True
ThisWorkbook.Close SaveChanges:=False
Else
'Otherwise, schedule a call to CheckTime in the future to check
'again later.
Application.OnTime (Now + TimeValue(TimeCheckDelay)), "CheckTime"
End If
End Sub

The code above is set to close the workbook without saving changes if it is
idle for more than 180 minutes (3 hours). It will check every 10 minutes.

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Hope this helps,

Hutch

"Looping through" wrote:

Is there a way to have a pop up notice appear if a open workbook is open but
no information is being inputed or no cells are being activated or tabs being
selected?

Basically tell the current user to close the workbook due to inactivity.

I have a shared file that sometimes get's left open on someone computer and
that person moves on to other tasks without closing it.

Is this possible?
TIA
Peter

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I email an inactive copy of a worksheet Jackaroo 1281 Excel Discussion (Misc queries) 1 January 1st 09 03:36 PM
Worksheet events inactive David Excel Programming 7 June 25th 08 08:25 AM
With block does not work on inactive worksheet? Vik[_3_] Excel Programming 1 August 1st 05 10:36 AM
Assign Range - Inactive Worksheet jazzjava Excel Programming 6 June 16th 05 01:39 AM
How to get the activecell of inactive worksheet ? steven[_2_] Excel Programming 5 April 18th 04 12:59 PM


All times are GMT +1. The time now is 07:04 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"