#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,726
Default Timer Code

Add this to a general module

Option Explicit

Public nTime As Double

Public Sub closemedown()
ThisWorkbook.Save
ThisWorkbook.Close
End Sub


and then add this to ThisWorkbook

Option Explicit

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.OnTime nTime, "closemedown", , False
End Sub

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
nTime = Now + TimeSerial(1, 30, 0)
Application.OnTime nTime, "closemedown"
End Sub

Private Sub Workbook_Open()
nTime = Now + TimeSerial(1, 30, 0)
Application.OnTime nTime, "closemedown"
End Sub

--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"Al" wrote in message
...
Hello
I am having a problem with a file being left open and I would like code to
automatically close the file after 90 minutes after the last change on any
page in the wb with changes saved before the close.
Can this be done? How?
Thanks



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
Timer Code nickysquawkes[_2_] Excel Programming 3 January 19th 06 12:11 PM
Timer code pmguerra Excel Programming 1 December 15th 05 01:37 PM
A VB code for creating count down timer / stopwatch... sanskar_d Excel Programming 2 June 17th 05 11:46 AM
VBA Code help - first timer Poots Excel Programming 2 June 9th 05 07:30 PM
How to code a timer to trigger a sub-routine ? Joseph[_10_] Excel Programming 1 December 18th 03 12:48 PM


All times are GMT +1. The time now is 11:35 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"