Hide/Unhide Sheets only working once...

  • Hi all! I'm trying (slowly) to get to grips with VBA so bear with me as i try to explain the problem! I'm in awe of all you experts!!


    I've created a user form to act as a timesheet system for staff. They log in with user name and password, enter their information and submit their timesheet. The data is then copied over to another sheet for my use. All fine and dandy so far.
    From the site here I encorporated some code to hide all sheets except one that shows advice when the user disabled macros. Again all good except that this only works once :?
    I'm guessing I've got my hideall/ showall code in the wrong place or something but anything I've tried doesnt seem to fix the problem..... :(




    Appologies for the length of my post.... :oops:

  • Re: Hide/Unhide Sheets only working once...


    You need to move to move calling HideAll tothe Before Close

    Code
    1. Private Sub Workbook_BeforeClose(Cancel As Boolean)
    2. bIsClosing = True
    3. Call HideAll
    4. End Sub


    Delete from the Before Save

  • Re: Hide/Unhide Sheets only working once...


    Hmmm I think its because of the code behind the submit and cancel command buttons on my user form...... Do I need to call the hide all code here too?? How would I do this? :thanx:


  • Re: Hide/Unhide Sheets only working once...


    Quote from Bob Phillips


    Also, why not just use Application.Visible = False to hide the application?


    So that I can have the warning if the user selects Disable Macros.....

  • Re: Hide/Unhide Sheets only working once...


    Quote from Gra

    So that I can have the warning if the user selects Disable Macros.....


    Surely, it is the Message sheet that handles that, whereby no sheets get unhidden?

  • Re: Hide/Unhide Sheets only working once...


    Quote from Bob Phillips

    Surely, it is the Message sheet that handles that, whereby no sheets get unhidden?



    Hi again Bob,
    Thanks so much for your answers but I'm afraid I dont quite follow this one... :? What do you mean by the Message sheet? Sorry, I'm probably being a dunce :duh: