+ Reply to Thread
Results 1 to 5 of 5

Workbook automatically opens after closing

  1. #1
    Registered User
    Join Date
    12-08-2009
    Location
    Illinois
    MS-Off Ver
    Excel 2007
    Posts
    19

    Workbook automatically opens after closing

    I have a workbook on a share drive that is used by multiple people. In the event that someone leaves the workbook open after using it, I have a timer function that pops up a splash screen after 4 minutes of inactivity which states, "This workbook will close in 1 minute if there is no further activity". If there is no further activity in that minute, the workbook closes.

    The code works fine...unless the workbook is manually closed in that minute between the splash screen and when the timer would have closed the workbook. If that happens, the workbook closes normally and then briefly reopens and closes a minute later when the timer would have closed the workbook.

    Is there any code to prevent this?

    Please Login or Register  to view this content.
    Last edited by SJB; 01-11-2010 at 12:47 PM.

  2. #2
    Valued Forum Contributor blane245's Avatar
    Join Date
    02-20-2009
    Location
    Melbourne, FL
    MS-Off Ver
    Excel 2010
    Posts
    649

    Re: Workbook automatically opens after closing

    You need to kill the timer when the workbook closes so it doesn't time out with a closed workbook.

  3. #3
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Workbook automatically opens after closing

    Hi SJB
    blane245 is correct; you need to stop the timer when you close the workbook else, unless you've also closed the Excel session, the timer will reopen the workbook and run again. I discovered this after many frustrating hours 6 or 8 months ago.
    The way I solved my issue was to create a Worksheet Before Close Event such as this
    Please Login or Register  to view this content.
    and that did the trick for me.
    John
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  4. #4
    Registered User
    Join Date
    12-08-2009
    Location
    Illinois
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: Workbook automatically opens after closing

    John -

    Thanks for the help. Unfortunately I know just enough VB to be dangerous. I'm not sure how to incorporate your suggestion into my code. Can you give me some more details?

    Thanks,

    Steve

  5. #5
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Workbook automatically opens after closing

    Hi Steve
    Be glad to help if I can. Open your workbook then open VBA (ALT F11 or select Developer Tab, then Visual Basic. On the left side, you'll see "This Workbook". Double click on "This Workbook". Copy this code
    Please Login or Register  to view this content.
    and paste it to the right pane in your VBA screen. I don't know the consequences of running your files on a shared drive but I believe this should work. That should do it.
    If you have issues or can't figure out the process, let me know. I'll be glad to help further.
    John

+ 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