From: Eric on
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
First  |  Prev  | 
Pages: 1 2
Prev: Comment in every 10 the row
Next: if else if...