PC Review


Reply
Thread Tools Rate Thread

Can I set an automatic timeout for a shared spreadsheet?

 
 
=?Utf-8?B?TWFyaWU=?=
Guest
Posts: n/a
 
      15th Mar 2007
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 With Quote
 
 
 
 
=?Utf-8?B?V29vZCBHcmFmaW5n?=
Guest
Posts: n/a
 
      15th Mar 2007
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 With Quote
 
=?Utf-8?B?V29vZCBHcmFmaW5n?=
Guest
Posts: n/a
 
      15th Mar 2007
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

 
Reply With Quote
 
=?Utf-8?B?TWFyaWU=?=
Guest
Posts: n/a
 
      15th Mar 2007
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 With Quote
 
=?Utf-8?B?SmltIFRob21saW5zb24=?=
Guest
Posts: n/a
 
      15th Mar 2007
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 With Quote
 
=?Utf-8?B?TWFyaWU=?=
Guest
Posts: n/a
 
      15th Mar 2007
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 With Quote
 
=?Utf-8?B?SmltIFRob21saW5zb24=?=
Guest
Posts: n/a
 
      15th Mar 2007
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 With Quote
 
=?Utf-8?B?TWFyaWU=?=
Guest
Posts: n/a
 
      15th Mar 2007
Perfect. Many Thanks.
marie

"Jim Thomlinson" wrote:

> 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 With Quote
 
=?Utf-8?B?cm9ja2hhbW1lcg==?=
Guest
Posts: n/a
 
      28th Mar 2007
Must Application.OnTime xxxx always execute a macro?
Can I just have wait a specified period of time and then do nothing? in
other words I just want a loop that waits a while.
I know I can create a do nothing macro but thought I can be more elegant
than that.

Also where can I find an explanation of the full syntax of Application.OnTime?

Thanks.

"Marie" wrote:

> Perfect. Many Thanks.
> marie
>
> "Jim Thomlinson" wrote:
>
> > 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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
link a local spreadsheet to a network shared spreadsheet Leo Microsoft Excel Setup 1 21st Mar 2008 10:37 AM
Automatic E-mail and Excel Spreadsheet on shared drive =?Utf-8?B?bWFyeSBz?= Microsoft Outlook Discussion 1 23rd Mar 2007 04:58 PM
Automatic Session timeout - sporadically =?Utf-8?B?cHJhZGVlcF9UUA==?= Microsoft ASP .NET 2 3rd Feb 2006 07:53 AM
Setting timeout on a shared drive on XP Pro Paul Sloboda Windows XP Setup 0 16th Oct 2003 07:05 PM
Automatic Logoff timeout Misaro Microsoft Windows 2000 Active Directory 1 1st Oct 2003 02:07 PM


Features
 

Advertising
 

Newsgroups
 


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