+ Reply to Thread
Results 1 to 4 of 4

Timer and timed close of a spreadsheet

  1. #1
    Registered User
    Join Date
    10-14-2009
    Location
    Bristol,England
    MS-Off Ver
    Excel 2007
    Posts
    22

    Timer and timed close of a spreadsheet

    I have within my workbooks a procedure that if the book has not been touched for an hour it auto saves and closes.

    My Issue: What I want to do is either

    1. Have a count down timer counting down on the status bar from 60 minutes to 00, which upon reaching 00 will trigger the close event, without any intervention i.e. i don't want a message box to appear as it doesn't now.

    2. If the workbook is touched, then the clock resets to 60 minutes

    or

    1. Have a auto closing message box pop up with 10 minutes to go to say that this workbook will close in ten minutes, and then count down the time.

    2. Again reset the timer if it is used.

    I basically want to have the countdown time visible, but without having any intervention from users in starting or stopping it other than using/not using the sheet.

    Most of the solutions i have found seem to have some form of user intervention, i.e. messagebox with yes no buttons.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Timer and timed close of a spreadsheet

    Hello jeffwest2,

    This macro code will close and save the workbook automatically if the mouse hasn't been moved for an hour. Copy this code to a VBA module. You will need to add a macro to the Workbook_Open event and a macro to the Workbook_BeforeClose() event. Samples are shown below.
    Please Login or Register  to view this content.
    Workbook Module Code
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    10-14-2009
    Location
    Bristol,England
    MS-Off Ver
    Excel 2007
    Posts
    22

    Re: Timer and timed close of a spreadsheet

    Leith

    Cheers for this, i will give it as go and see how i get on.

  4. #4
    Registered User
    Join Date
    10-14-2009
    Location
    Bristol,England
    MS-Off Ver
    Excel 2007
    Posts
    22

    Re: Timer and timed close of a spreadsheet

    Below is the code that i am using, i have added the bits from yours and added the module, this works fine, it counts down from 10 minutes to 0, the problems i am having.

    1. If i add the MouseMonitorOff into the auto close, it just closes the statusbar at the bottom or does nothing.

    2. If i add it to the Workbook_BeforeClose, it does nothing.

    I guess what i need, and i can't seem to get the coding right, is exaclty what i have but if it closes because the time is up, it just saves closes, if however the user closes the workbook, then it ask if they want to save the changes, any help would be greatly appreciated

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1