+ Reply to Thread
Results 1 to 11 of 11

Closing WB with a timer no changing sheets to very hidden

  1. #1
    Forum Contributor Nitro2481's Avatar
    Join Date
    09-09-2014
    Location
    Laois, Ireland
    MS-Off Ver
    2013
    Posts
    323

    Closing WB with a timer no changing sheets to very hidden

    Hi Guys,

    I have this code in my "This workbook"
    Please Login or Register  to view this content.
    This changes all sheets from very hidden to visible and when closing back to very hidden again. This stops sheets from being visible if there is a macro error when the sheet is starting up. This works perfect.

    I also have a timer set up that if there is no activity in 10 minutes the workbook auto closes. When this happens the sheets do not change to very hidden therefore and macro errors going forward display all sheets which I really do not want.
    Please Login or Register  to view this content.
    I'm assuming I also need a "change all sheets to very hidden on close" code in the timer section but not sure how I would go about that.

    I have manually set all sheets bar Splash to very hidden. If you close this with the x on top and try to open the spreadsheet with macros on high you get a warning with only the splash sheet visible. If the timer runs out (for this example I have set the timer at 1 min)and the sheet closes and you reopen with macros set to high you get the same warning message but all sheets are visible and accessible. Although I am aware that Excel is not secure I am more worried about someone stumbling across this information as opposed to being malicious. I have attached the spreadsheet. If you select user name: John and password: Test

    Thank you
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    01-03-2016
    Location
    Conwy, Wales
    MS-Off Ver
    2016
    Posts
    974

    Re: Closing WB with a timer no changing sheets to very hidden

    Insert this in the code before file saves and closes.
    There must be at least one sheet visible - assumes that "Splash" is that sheet. All other sheets are hidden.

    Please Login or Register  to view this content.
    To unhide all sheets
    Please Login or Register  to view this content.
    If a response has helped then please consider rating it by clicking on *Add Reputation below the post
    When your issue has been resolved don't forget to mark the thread SOLVED (click Thread Tools at top of thread)

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Closing WB with a timer no changing sheets to very hidden

    Kevin, you need to set Splash visible before running that first loop, for the very reason you mentioned.
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Valued Forum Contributor
    Join Date
    01-03-2016
    Location
    Conwy, Wales
    MS-Off Ver
    2016
    Posts
    974

    Re: Closing WB with a timer no changing sheets to very hidden

    @shg is correct. I was assuming that it was visible from the write up.
    To ensure that is the case, insert this line as the first line.
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor Nitro2481's Avatar
    Join Date
    09-09-2014
    Location
    Laois, Ireland
    MS-Off Ver
    2013
    Posts
    323

    Re: Closing WB with a timer no changing sheets to very hidden

    Thanks for the reply guys,

    I'm not great at code. I've been helped with everything I've done so far. Where do I put this extra code. I assumed it was in the timer module which I did below but this didn't rehide the sheets when the timer ran out.

    Please Login or Register  to view this content.

  6. #6
    Forum Contributor Nitro2481's Avatar
    Join Date
    09-09-2014
    Location
    Laois, Ireland
    MS-Off Ver
    2013
    Posts
    323

    Re: Closing WB with a timer no changing sheets to very hidden

    I have also tried it in "This Workbook"section but again didn't work although I expect I've put it in wrong

    Please Login or Register  to view this content.

  7. #7
    Valued Forum Contributor
    Join Date
    01-03-2016
    Location
    Conwy, Wales
    MS-Off Ver
    2016
    Posts
    974

    Re: Closing WB with a timer no changing sheets to very hidden

    You appear to have put the code in the correct place the first time.

    Here is a dummy file so that you can see the code working.
    When you open the file {ctrl} {shift} + T unhides all the sheets
    then {ctrl} + T hides them one by one with a message box so that you can see them close, ending up on "Splash" and then vba Saves and Close

    To work out why it is not working for you:
    Suggest you put a couple of message boxes (where indicated below) in your code so that you can see where it is not doing what is should be doing. The code may not be following the path you think it is. Hopefully these will give you a clue.
    (include the MsgBox lines as they are)
    Please Login or Register  to view this content.

    Please Login or Register  to view this content.
    Report back if working or not
    Attached Files Attached Files
    Last edited by Kevin#; 04-03-2016 at 07:12 AM.

  8. #8
    Forum Contributor Nitro2481's Avatar
    Join Date
    09-09-2014
    Location
    Laois, Ireland
    MS-Off Ver
    2013
    Posts
    323

    Re: Closing WB with a timer no changing sheets to very hidden

    Hi Kevin,

    Thanks a mil for your patience. I think I have it working with your first part of code.
    Please Login or Register  to view this content.
    The second part seems to be causing errors. Do I require this second part for any reason? Sheets are already programmed to unhide depending on who logs in. Your bit ensures all sheets return to hidden when timer runs out. I just want to make sure I'm not leaving myself open by leaving the second part out.

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  9. #9
    Valued Forum Contributor
    Join Date
    01-03-2016
    Location
    Conwy, Wales
    MS-Off Ver
    2016
    Posts
    974

    Re: Closing WB with a timer no changing sheets to very hidden

    Put the second part in another standalone subroutine - it is there to allow you to unhide all sheets

  10. #10
    Forum Contributor Nitro2481's Avatar
    Join Date
    09-09-2014
    Location
    Laois, Ireland
    MS-Off Ver
    2013
    Posts
    323

    Re: Closing WB with a timer no changing sheets to very hidden

    Hi Kevin,

    Have that working perfectly. Thanks a million for your help.

  11. #11
    Valued Forum Contributor
    Join Date
    01-03-2016
    Location
    Conwy, Wales
    MS-Off Ver
    2016
    Posts
    974

    Re: Closing WB with a timer no changing sheets to very hidden

    Glad you got it working.
    You puzzled out where the problem was for yourself - that's the only way to gain a real understanding of VBA.
    Thanks for the reps

+ 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] Sheets not changing to Very hidden when timer runs out
    By Nitro2481 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-02-2016, 11:28 AM
  2. Timer Macro Auto Closing Files
    By acroley1 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-02-2014, 11:57 AM
  3. [SOLVED] Closing a workbook with the menu hidden
    By grumpyguppy in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-08-2014, 06:41 AM
  4. How to have open a hidden sheet / hide on closing
    By danieluk9 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-10-2014, 01:14 PM
  5. [SOLVED] Format all cells in all sheets to Protection Hidden on visible and hidden tabs
    By DeRo22 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-28-2014, 03:17 PM
  6. [SOLVED] trying to access the excel sheets/Tabs in the hidden/very hidden mode through hyperlinks
    By Kiran Kurapati in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-30-2013, 06:50 AM
  7. Changing a csv format to xls and saving/closing
    By Jen_DPS in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 01-24-2007, 12:57 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