+ Reply to Thread
Results 1 to 3 of 3

Auto-Close an Inactive Workbook in Excel After So Much Time with prompt

  1. #1
    Registered User
    Join Date
    12-12-2014
    Location
    Arlington, Texas
    MS-Off Ver
    365
    Posts
    16

    Auto-Close an Inactive Workbook in Excel After So Much Time with prompt

    I am very new and green at trying my hand at the working in the vba screens in excel.

    I am working on a way to automatically close a spreadsheet after X amount of time of inactivity. I am wanting it to pop up a window after X amount of time asking the user if they are done and if yes the timer restarts and if no a new timer starts to close the window. I have my defaults set at :10 just to speed things up.

    We have a lot of people who share the excel file and do updates to it. I am using it in access as a linked table so if someone has it open nobody else can edit it.

    I admit I watched a video on this and I thought I had done everything correct, but I failed!

    Can someone take a look at my sheet attached and help me with the code and tell me where I messed up?

    I would like the code generic enough so I can move it to other workbooks we use.

    Thanks in advance for the help!
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,224

    Re: Auto-Close an Inactive Workbook in Excel After So Much Time with prompt

    XLSX files certainly do not contain code.

    What should be considered user inactivity? No action in Excel itself (no changes in the open workbook) or no action at the operating system level (no mouse and/or keyboard movement)?

    Artik

  3. #3
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    1,980

    Re: Auto-Close an Inactive Workbook in Excel After So Much Time with prompt

    Something along these lines.

    In a standard module:
    Please Login or Register  to view this content.

    Then in the Workbook module, start/stop the timer when the workbook's opened/closed.
    Reset it at various events.
    Please Login or Register  to view this content.

    The above saves and closes the workbook without a prompt if the workbook is not read only. For the popup, you can't use a normal message box as that will pause the code execution, so you'd probably want to make one with a userform that has a countdown so that it'll continue to close if no response is received from the user.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Auto Close Msg Box after Time Period & Close Workbook
    By GJF36 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-24-2015, 10:25 AM
  2. Can't close an inactive Workbook - result in error 9
    By gototcm in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-23-2014, 10:59 PM
  3. Auto close worksheet when inactive for 5 minute
    By adamosmond in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-28-2013, 01:01 AM
  4. [SOLVED] save without prompt and close the workbook at the same time
    By bta in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-27-2012, 06:43 AM
  5. Data Consolodation VBA - close inactive workbook
    By grahadw in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-06-2009, 12:38 PM
  6. Auto Close Workbook if inactive 5min
    By nigelog in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-05-2008, 01:36 PM
  7. [SOLVED] Option in Excel to save a close a workbook inactive for 5 minutes
    By Patricia Peterson in forum Excel General
    Replies: 4
    Last Post: 01-05-2006, 01:00 PM

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