Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 143
Default Can I set an automatic timeout for a shared spreadsheet?

We have a worksheet that is on a shared server. On occasion someone is
distracted and fails to close the worksheet, locking it up until our PC tech
comes in. As this spreadsheet is used in the U.S., Europe, and Asia, this has
created some serious issues.
Is there a way that we can force the spreadsheet closed, if no entry has
been made to it for 30 minutes?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default Can I set an automatic timeout for a shared spreadsheet?

This should get you started =)

Sub Auto_Open()
Application.OnTime Now() + TimeValue("00:30:00"), "CloseMe"
End Sub

Sub CloseMe()
ActiveWorkbook.Save
ActiveWorkbook.Close
End Sub

"Marie" wrote:

We have a worksheet that is on a shared server. On occasion someone is
distracted and fails to close the worksheet, locking it up until our PC tech
comes in. As this spreadsheet is used in the U.S., Europe, and Asia, this has
created some serious issues.
Is there a way that we can force the spreadsheet closed, if no entry has
been made to it for 30 minutes?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default Can I set an automatic timeout for a shared spreadsheet?

I should have elaborated a little more. Put the Sub Auto_Open into
ThisWorkbook, and the Sub CloseMe into a seperate module, and make it Public.
=)


Into Thisworkbook:

Sub Auto_Open()
Application.OnTime Now() + TimeValue("00:30:00"), "CloseMe"
End Sub

Into a new Module:

Public Sub CloseMe()
ActiveWorkbook.Save
ActiveWorkbook.Close
End Sub

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 143
Default Can I set an automatic timeout for a shared spreadsheet?

THANK YOU! If this works (and I'm confident it will), you have no idea how
happy you will have made our Seattle office!

"Wood Grafing" wrote:

This should get you started =)

Sub Auto_Open()
Application.OnTime Now() + TimeValue("00:30:00"), "CloseMe"
End Sub

Sub CloseMe()
ActiveWorkbook.Save
ActiveWorkbook.Close
End Sub

"Marie" wrote:

We have a worksheet that is on a shared server. On occasion someone is
distracted and fails to close the worksheet, locking it up until our PC tech
comes in. As this spreadsheet is used in the U.S., Europe, and Asia, this has
created some serious issues.
Is there a way that we can force the spreadsheet closed, if no entry has
been made to it for 30 minutes?

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Can I set an automatic timeout for a shared spreadsheet?

That code does not look for inactivity. It closes the file after 30 minutes
regardless... Here is a slight modification of that code. It will pop up a
timed message box every (currently set to 20 seconds for degbugging but you
can change it to 30 minutes). The message box will stay up for 2 seconds. If
you hit yes then the 20 second (30 Minute) clock will start again. If not
then it saves and closes the file... Not you need to reference "Windows
Script Host Object Model" (in the VBE Tools - References - "Windows Script
Host Object Model"). This code sould be placed in a standard code module.

Sub Auto_Open()
Application.OnTime Now() + TimeValue("00:00:20"), "CloseMe"
End Sub

'requires reference to "Windows Script Host Object Model"
Public Sub CloseMe()
Dim SH As IWshRuntimeLibrary.WshShell
Dim Res As Long

Set SH = New IWshRuntimeLibrary.WshShell
Res = SH.Popup(Text:="Are you still there?", secondstowait:=2, _
Title:="Active", Type:=vbYesNo)
If Res = vbYes Then
Application.OnTime Now() + TimeValue("00:00:20"), "CloseMe"
Else
ThisWorkbook.Save
ThisWorkbook.Close
End If
End Sub

--
HTH...

Jim Thomlinson


"Marie" wrote:

THANK YOU! If this works (and I'm confident it will), you have no idea how
happy you will have made our Seattle office!

"Wood Grafing" wrote:

This should get you started =)

Sub Auto_Open()
Application.OnTime Now() + TimeValue("00:30:00"), "CloseMe"
End Sub

Sub CloseMe()
ActiveWorkbook.Save
ActiveWorkbook.Close
End Sub

"Marie" wrote:

We have a worksheet that is on a shared server. On occasion someone is
distracted and fails to close the worksheet, locking it up until our PC tech
comes in. As this spreadsheet is used in the U.S., Europe, and Asia, this has
created some serious issues.
Is there a way that we can force the spreadsheet closed, if no entry has
been made to it for 30 minutes?



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 143
Default Can I set an automatic timeout for a shared spreadsheet?

That works great!
Would you happen to know the code to close the excel application, as well as
the spreadsheet?... :)
Thank you,
Marie

"Jim Thomlinson" wrote:

That code does not look for inactivity. It closes the file after 30 minutes
regardless... Here is a slight modification of that code. It will pop up a
timed message box every (currently set to 20 seconds for degbugging but you
can change it to 30 minutes). The message box will stay up for 2 seconds. If
you hit yes then the 20 second (30 Minute) clock will start again. If not
then it saves and closes the file... Not you need to reference "Windows
Script Host Object Model" (in the VBE Tools - References - "Windows Script
Host Object Model"). This code sould be placed in a standard code module.

Sub Auto_Open()
Application.OnTime Now() + TimeValue("00:00:20"), "CloseMe"
End Sub

'requires reference to "Windows Script Host Object Model"
Public Sub CloseMe()
Dim SH As IWshRuntimeLibrary.WshShell
Dim Res As Long

Set SH = New IWshRuntimeLibrary.WshShell
Res = SH.Popup(Text:="Are you still there?", secondstowait:=2, _
Title:="Active", Type:=vbYesNo)
If Res = vbYes Then
Application.OnTime Now() + TimeValue("00:00:20"), "CloseMe"
Else
ThisWorkbook.Save
ThisWorkbook.Close
End If
End Sub

--
HTH...

Jim Thomlinson


"Marie" wrote:

THANK YOU! If this works (and I'm confident it will), you have no idea how
happy you will have made our Seattle office!

"Wood Grafing" wrote:

This should get you started =)

Sub Auto_Open()
Application.OnTime Now() + TimeValue("00:30:00"), "CloseMe"
End Sub

Sub CloseMe()
ActiveWorkbook.Save
ActiveWorkbook.Close
End Sub

"Marie" wrote:

We have a worksheet that is on a shared server. On occasion someone is
distracted and fails to close the worksheet, locking it up until our PC tech
comes in. As this spreadsheet is used in the U.S., Europe, and Asia, this has
created some serious issues.
Is there a way that we can force the spreadsheet closed, if no entry has
been made to it for 30 minutes?

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Can I set an automatic timeout for a shared spreadsheet?

Application.Quit

Careful with that one as there may be other books open when you execute the
code and you need to handle the other books in that case...
--
HTH...

Jim Thomlinson


"Marie" wrote:

That works great!
Would you happen to know the code to close the excel application, as well as
the spreadsheet?... :)
Thank you,
Marie

"Jim Thomlinson" wrote:

That code does not look for inactivity. It closes the file after 30 minutes
regardless... Here is a slight modification of that code. It will pop up a
timed message box every (currently set to 20 seconds for degbugging but you
can change it to 30 minutes). The message box will stay up for 2 seconds. If
you hit yes then the 20 second (30 Minute) clock will start again. If not
then it saves and closes the file... Not you need to reference "Windows
Script Host Object Model" (in the VBE Tools - References - "Windows Script
Host Object Model"). This code sould be placed in a standard code module.

Sub Auto_Open()
Application.OnTime Now() + TimeValue("00:00:20"), "CloseMe"
End Sub

'requires reference to "Windows Script Host Object Model"
Public Sub CloseMe()
Dim SH As IWshRuntimeLibrary.WshShell
Dim Res As Long

Set SH = New IWshRuntimeLibrary.WshShell
Res = SH.Popup(Text:="Are you still there?", secondstowait:=2, _
Title:="Active", Type:=vbYesNo)
If Res = vbYes Then
Application.OnTime Now() + TimeValue("00:00:20"), "CloseMe"
Else
ThisWorkbook.Save
ThisWorkbook.Close
End If
End Sub

--
HTH...

Jim Thomlinson


"Marie" wrote:

THANK YOU! If this works (and I'm confident it will), you have no idea how
happy you will have made our Seattle office!

"Wood Grafing" wrote:

This should get you started =)

Sub Auto_Open()
Application.OnTime Now() + TimeValue("00:30:00"), "CloseMe"
End Sub

Sub CloseMe()
ActiveWorkbook.Save
ActiveWorkbook.Close
End Sub

"Marie" wrote:

We have a worksheet that is on a shared server. On occasion someone is
distracted and fails to close the worksheet, locking it up until our PC tech
comes in. As this spreadsheet is used in the U.S., Europe, and Asia, this has
created some serious issues.
Is there a way that we can force the spreadsheet closed, if no entry has
been made to it for 30 minutes?

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
Shared File Automatic Update kefee85 Excel Discussion (Misc queries) 1 September 18th 09 02:21 AM
link a local spreadsheet to a network shared spreadsheet Leo Setting up and Configuration of Excel 1 March 21st 08 10:37 AM
shared spreadsheet on a shared drive Meridith Excel Discussion (Misc queries) 0 January 23rd 08 02:16 AM
Shared spreadsheet syssupspe Excel Discussion (Misc queries) 2 February 8th 06 07:34 PM
TImeIn-TimeOut-TimeIn-TimeOut-HoursWorked ChefBoiRD Excel Worksheet Functions 3 September 20th 05 10:01 AM


All times are GMT +1. The time now is 10:11 PM.

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

About Us

"It's about Microsoft Excel"