+ Reply to Thread
Results 1 to 7 of 7

Save and Close Timer

  1. #1
    Forum Contributor
    Join Date
    06-03-2008
    Posts
    387

    Save and Close Timer

    I have a workbook that is going to be placed on a server where a large amount of people will need access to it. I've read that the 'sharing' in Excel tends to cause the file to become corrupt, so I'd like to avoid that outcome.

    Since, only one user will be allowed into the workbook at a time, I'd like to write code that kicks the user out after a certain amount of time. The code would have a timer that starts when they open the workbook and at the 30 minute mark, it saves and closes the workbook. (I'll probably put some code in there where they can cancel the operation as well.)

    I've used everything previously except for a timer, so if someone could give me an example of a timer it would get me rolling.

  2. #2
    Forum Contributor
    Join Date
    06-03-2008
    Posts
    387

    Re: Save and Close Timer

    Just found a great reference on this matter here:

    http://www.cpearson.com/excel/OnTime.aspx

  3. #3
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Save and Close Timer

    To run a procedure after 30 minutes, you can use OnTime:
    Please Login or Register  to view this content.
    You need to make sure that the schedule is cleared when closing the workbook:
    Please Login or Register  to view this content.
    in case the user closes before the macro is scheduled to run, otherwise the workbook may be reopened to run the macro.
    Remember what the dormouse said
    Feed your head

  4. #4
    Forum Contributor
    Join Date
    06-03-2008
    Posts
    387

    Re: Save and Close Timer

    Is there a way to put a Yes/No box on a timer? So that if a user doesn't answer, "Yes', in 30 seconds it will assume "No".

  5. #5
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Save and Close Timer

    Yes - see the code here for example. Or you could use a userform.

  6. #6
    Forum Contributor
    Join Date
    06-03-2008
    Posts
    387

    Re: Save and Close Timer

    Please Login or Register  to view this content.
    I found this code here:
    http://www.pcreview.co.uk/forums/thread-947406.php

    It works great for a messagebox pop-up, but I'm unsure of how to check the value.

  7. #7
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Save and Close Timer

    The popup method is not reliable, unfortunately. I think you would be better off with a userform.

+ 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