+ Reply to Thread
Results 1 to 9 of 9

"Autoclose after inactivity" macro

  1. #1
    Registered User
    Join Date
    11-06-2008
    Location
    Illinois
    Posts
    63

    "Autoclose after inactivity" macro

    Hello all,

    I am using the following macro code on a protected unshared workbook used by multiple users across an intranet and am trying to implement 2 additions to the macro code:

    1. Disable the startup Autoclose message text box for users who open the file using 'Read Only' or 'Notify'.

    2. Change the code so that the ShutDown clock resets itself if the mouse is moved, a new cell is selected, a new worksheet is selected, or a new workbook is selected. Basically, I want to keep the workbook open for any sort of user activity.

    The problem I am running into is that the workbook will still autoclose on a user who is simply tabbing between workbooks to view data, or simply using the mouse to select new cells.

    'MODULE 1'
    Please Login or Register  to view this content.
    'THIS WORKBOOK'
    Please Login or Register  to view this content.
    Any ideas? Thanks!

    Nick
    Attached Files Attached Files
    Last edited by Nickster64; 12-12-2008 at 11:09 AM.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    This code works if a workbook is unused for say 10 minutes

    Please Login or Register  to view this content.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    11-06-2008
    Location
    Illinois
    Posts
    63
    Thank you for the quick reply royUK.

    I am having trouble using the code you had posted... Should I paste your code in 'This Workbook' or 'Module 1' and should I delete the old code from my original 'This Workbook' or 'Module 1' after replacing with your new code?

    Thanks,

    Nick

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Remove your old code. Place this code in a Standard Module

    Please Login or Register  to view this content.
    Slightly changing this, if you use the WorkBook module then it will work if any sheet is changed

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    11-06-2008
    Location
    Illinois
    Posts
    63
    Thanks, I got it to work and also added my text box but my original 2 issues are still present:

    1. Disable the startup Autoclose message text box for users who open the file using 'Read Only' or 'Notify'.

    2. Change the code so that the ShutDown clock resets itself if the mouse is moved, a new cell is selected, a new worksheet is selected, or a new workbook is selected. Basically, I want to keep the workbook open for any sort of user activity.

    The problem I am running into is that the workbook will still autoclose on a user who is simply tabbing between workbooks to view data, or simply using the mouse to select new cells.

  6. #6
    Registered User
    Join Date
    11-06-2008
    Location
    Illinois
    Posts
    63
    Is it possible to use a similar code which performs the Windows screen saver function and implement that within the Excel macro? This would be great because with the Windows screen saver mode your screen comes back to life with just mouse movement. This would definitely take care of my problem #2 I mention above.

  7. #7
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Aded thsi as a separate Procedure in the Standard Module

    Please Login or Register  to view this content.
    To detect changes in sheets & moving from workbook to workbook, etc use the WorkBook events

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    11-06-2008
    Location
    Illinois
    Posts
    63

    Arrow

    Thanks! I have been been working with this code on and off all day and in the process have learned a lot about VB (I'm just starting but am quickly getting the hang of it). I found some errors in your posted code: The workbook would not save before closing, there was a "Compile Error: Ambiguous name detected. Workbook_SheetChange", and the workbook was still closing even when one moved between cells, workbooks, or programs.

    Through much trial and error I believe I fixed most of them and have posted the code below. However, I am still having trouble with keeping the workbook open while simultaneously working with other programs and also moving between cells.

    I believe the ultimate solution to all these knacks would be to restart the Timer if the user moves the mouse regardless of whether or not Excel is currently the active running program but this is beyond my level of knowledge. Any thoughts?

    Here is what I now have:

    ThisWorkbook
    Please Login or Register  to view this content.

    Module1
    Please Login or Register  to view this content.
    Best regards,

    Nick

  9. #9
    Forum Contributor
    Join Date
    02-20-2009
    Location
    bristol
    MS-Off Ver
    Excel 2003
    Posts
    882

    Re: "Autoclose after inactivity" macro

    Thanks Roy for this wonderful Post. Just thinking if we are not making changes in the worksheet but we are working on the userform then if no body is using the userform for 5 minutes then close the workbook???

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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