PC Review


Reply
Thread Tools Rate Thread

How to close excel worksheet after 15 mins? once it opened

 
 
Eric
Guest
Posts: n/a
 
      11th May 2010
I am using Excel 2003.
Once I open a workbook, I would like to close it after 15 mins automatically.
Does anyone have any suggestions on how to code it in macro?
Thanks in advance for any suggestions
Eric
 
Reply With Quote
 
 
 
 
Mike H
Guest
Posts: n/a
 
      11th May 2010
Hi,

Here's a nice simple way

http://www.ozgrid.com/forum/showthread.php?t=42169
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"Eric" wrote:

> I am using Excel 2003.
> Once I open a workbook, I would like to close it after 15 mins automatically.
> Does anyone have any suggestions on how to code it in macro?
> Thanks in advance for any suggestions
> Eric

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      11th May 2010
Saved from a previous post:

So you would want to force the user to close the file -- even though you don't
know if the current changes should be saved or discarded?

That sounds like a disaster for you, your co-worker, and your boss -- who's
going to be upset that something got saved that shouldn't have -- or 8 hours of
work was discarded and shouldn't have been.

I think that this is a training issue.

But if you look at Chip's site to see how to close a workbook after a given time
of inactivity.

http://www.cpearson.com/excel/TimedClose.htm

(I can't say how much I think that this is a bad idea!)

Eric wrote:

> I am using Excel 2003.
> Once I open a workbook, I would like to close it after 15 mins automatically.
> Does anyone have any suggestions on how to code it in macro?
> Thanks in advance for any suggestions
> Eric


--

Dave Peterson
 
Reply With Quote
 
Peter T
Guest
Posts: n/a
 
      11th May 2010

"Dave Peterson" <(E-Mail Removed)> wrote in message news:%
> Saved from a previous post:
>
> So you would want to force the user to close the file -- even though you
> don't
> know if the current changes should be saved or discarded?
>
> That sounds like a disaster for you, your co-worker, and your boss --
> who's
> going to be upset that something got saved that shouldn't have -- or 8
> hours of
> work was discarded and shouldn't have been.
>
> I think that this is a training issue.
>
> But if you look at Chip's site to see how to close a workbook after a
> given time
> of inactivity.
>
> http://www.cpearson.com/excel/TimedClose.htm
>
> (I can't say how much I think that this is a bad idea!)


I think you just did <g>

Peter T


 
Reply With Quote
 
Eric
Guest
Posts: n/a
 
      11th May 2010
When I edit the file, which usually take less than 30 mins, then I will save
and close it manually. On the other hands, I set schedule task to open
specific file at specific time for reading only, therefore saving it before
closing is good for me.
I don't know whether I work on this file or not, once this file opens based
on schedule.

Once this file is opened at 10 am, I am still working on this file for 45
mins, and finish at 10:46 am. This file should not be automatically saved
and close at 10:31 am, because it does not inactivity for 10 mins. On the
other hands, if this file is inactivity for 10 mins after 30 mins, the this
file should be saved and close at 10:56 am.
For example,
1) Once this file is opened at 10 am, it should be saved and close at 10:31
am and inactivity for 10 mins between 10:21 am and 10:31 am.

2) if file is inactive starting at 10:22 am, this file should be saved and
closed at 10:32, because it passes the first 30 mins and inactivity for 10
mins since 10:22 am.

3) if file is inactive starting at 10:36 am, this file should be saved and
closed at 10:46, because it passes the first 30 mins and inactivity for 10
mins since 10:36 am.

Does anyone have any suggestions on how to add this condition to macro coding?
Thank everyone very much for any suggestions
Eric


"Dave Peterson" wrote:

> Saved from a previous post:
>
> So you would want to force the user to close the file -- even though you don't
> know if the current changes should be saved or discarded?
>
> That sounds like a disaster for you, your co-worker, and your boss -- who's
> going to be upset that something got saved that shouldn't have -- or 8 hours of
> work was discarded and shouldn't have been.
>
> I think that this is a training issue.
>
> But if you look at Chip's site to see how to close a workbook after a given time
> of inactivity.
>
> http://www.cpearson.com/excel/TimedClose.htm
>
> (I can't say how much I think that this is a bad idea!)
>
> Eric wrote:
>
> > I am using Excel 2003.
> > Once I open a workbook, I would like to close it after 15 mins automatically.
> > Does anyone have any suggestions on how to code it in macro?
> > Thanks in advance for any suggestions
> > Eric

>
> --
>
> Dave Peterson
> .
>

 
Reply With Quote
 
Eric
Guest
Posts: n/a
 
      12th May 2010
I find following codes to be useful, but there is some issue missing for
following combined conditions.

For example,
1) Once this file is opened at 10 am, it should be saved and close at 10:31
am and inactivity for 10 mins between 10:21 am and 10:31 am.

2) if file is inactive starting at 10:22 am, this file should be saved and
closed at 10:32, because it passes the first 30 mins and inactivity for 10
mins since 10:22 am.

3) if file is inactive starting at 10:36 am, this file should be saved and
closed at 10:46, because it passes the first 30 mins and inactivity for 10
mins since 10:36 am.

Does anyone have any suggestions on how to add this condition to macro coding?
Thank everyone very much for any suggestions
Eric


Private Sub Workbook_Open()
dTime = Time
On Error Resume Next
Application.OnTime dTime + TimeValue("00:30:00"), "CloseMe"
On Error Goto 0
End Sub

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target
As Range)
On Error Resume Next
Application.OnTime dTime + TimeValue("00:10:00"), "CloseMe", , False
dTime = Time
Application.OnTime dTime + TimeValue("00:10:00"), "CloseMe"
On Error Goto 0
End Sub

Public dTime As Date
Sub CloseMe()
ThisWorkbook.Close
End Sub


"Mike H" wrote:

> Hi,
>
> Here's a nice simple way
>
> http://www.ozgrid.com/forum/showthread.php?t=42169
> --
> Mike
>
> When competing hypotheses are otherwise equal, adopt the hypothesis that
> introduces the fewest assumptions while still sufficiently answering the
> question.
>
>
> "Eric" wrote:
>
> > I am using Excel 2003.
> > Once I open a workbook, I would like to close it after 15 mins automatically.
> > Does anyone have any suggestions on how to code it in macro?
> > Thanks in advance for any suggestions
> > Eric

 
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
Protect Excel Worksheet to be opened on one PC only Fabian Microsoft Excel Misc 11 1st Sep 2009 09:58 PM
Excel won't close when opened from Access Jeff Hunt Microsoft Access Form Coding 5 22nd Dec 2008 02:08 PM
can't close files opened in an excel application?? =?Utf-8?B?dXJnZW50?= Microsoft Excel Programming 3 29th Sep 2005 01:33 AM
Excel worksheet opened twice =?Utf-8?B?RGFuaXRhIFNpbW9u?= Microsoft Excel Misc 2 5th Nov 2004 10:01 PM
Password Prompt When I Close an Excel Document I Opened in a Web Browser Dany Microsoft Excel Misc 0 12th Aug 2004 10:08 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:30 PM.