+ Reply to Thread
Results 1 to 7 of 7

Will not auto Close down workbook when screensaver active

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

    Will not auto Close down workbook when screensaver active

    I have a 'few' workbooks that I have added some code to which auto closes the workbook if it has been inactive for more than 60 minutes.

    Problem seems to be is that this doesn't envoke if a screen saver is active, does anyone have any VB code to disable the screen saver until after the workbook has closed.
    Last edited by jeffwest2; 12-11-2009 at 10:41 AM. Reason: solved

  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: Will not auto Close down workbook when screensaver active

    Hello jeffwest2,

    Place this macro in its own VBA module. You can then call it in your code to turn the screen saver on and off.
    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
    Forum Expert davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2010
    Posts
    1,884

    Re: Will not auto Close down workbook when screensaver active

    Hey Leith, that is a sweet piece of code. I have an issue where once my screensaver has been on for a minute, windows XP locks my workstation. Is there a way to unlock it with vba, or, if not, would the procedure run regardless?
    Is your code running too slowly?
    Does your workbook or database have a bunch of duplicate pieces of data?
    Have a look at this article to learn the best ways to set up your projects.
    It will save both time and effort in the long run!


    Dave

  4. #4
    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: Will not auto Close down workbook when screensaver active

    Hello davegugg,

    If the code is already running or scheduled to run at a set time, the API macro should still work. Locking the workstation should only ignore external events, like keystrokes and mouse movements. Give it a try and let me know what happens.

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

    Re: Will not auto Close down workbook when screensaver active

    Leith

    Thanks for this, i will give it a try out in my code see how i get in.

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

    Re: Will not auto Close down workbook when screensaver active

    Leith

    Not sure what's wrong, i added it as a module on it's own, then added to the workbook_open a call to the function using ScreenSaverOn False.

    However, after 15 minutes the screensaver kicked in, and my auto shutdown didn't work.

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

    Re: Will not auto Close down workbook when screensaver active

    Kind of solved my problem.

    The issue wasn't with the close code, the issue was with a user form i had created.

    This was envoked after the 60 minutes limit to tell the user they had 1 minute before close down, this was a non user intervention form i.e. no buttons, it stayed on screen for 1 minute, when this closed it then saved and closed the workbook down, however, this wasn't closing down after the minute, instead it was staying on screen, behind the screen saver, until the user moved the mouse/pushed a button.

    Turning this warning off has solved the issue, although i don't understand why this should be the case, for now my workbook closes.

+ 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