+ Reply to Thread
Results 1 to 10 of 10

Option to hide the sheet when "Disable Macros" is clicked

  1. #1
    Forum Contributor
    Join Date
    04-21-2009
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    112

    Option to hide the sheet when "Disable Macros" is clicked

    Dear Experts,

    Is there any option to deactivate the "Disable macros"

    Or

    When i open the userform it asks for enable and diable macros. If i click "Disable macros" then the users can manipulate the data inside the excel sheet. i need to avoid this problem.

    So, is there any option that if i do "Disable macro" then the corresponding sheet for the which the Userform is linked should not be visible or hidden.

    Please let me know the procedure!!!

    Regards,
    Alex

  2. #2
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile Re: Option to hide the sheet when "Disable Macros" is clicked

    Good afternoon sivdin
    Quote Originally Posted by sivdin View Post
    Is there any option to deactivate the "Disable macros"

    So, is there any option that if i do "Disable macro" then the corresponding sheet for the which the Userform is linked should not be visible or hidden.
    There is no foolproof way to force a user to enable macros, however there is a workaround technique. The entire workbook apart from one sheet needs to be hidden, and a set of macros will unhide all the necessary sheets on opening. If the user doesn't accept macros, only one sheet (which usually carries a warning) can be seen. When the user closes a workbook, a macro has to intercept this call, hide all but one of the sheets and force a save.

    Not perfect, but it (kind of) works.

    There is a ready made solution here for you to use.

    Alternatively, there is a really clever tip on the subject - a slightly different method - here from Chip Pearson.

    HTH

    DominicB
    Please familiarise yourself with the rules before posting. You can find them here.

  3. #3
    Forum Contributor
    Join Date
    04-21-2009
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    112

    Re: Option to hide the sheet when "Disable Macros" is clicked

    Dear

    The macros are not working in my workbook.
    I copied the code. But when the click either "Enable Macros" or "Disable macros" only one sheet is visible for ,e.

    My requirement is when i click "Disable macros" and open the workbook, the sheet for which i created the useform should not be visible. Only if i do "Enable macros" then only my required sheet should open

    Solutions Please!!!!

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Option to hide the sheet when "Disable Macros" is clicked

    See this example
    Hope that helps.

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

    Free DataBaseForm example

  5. #5
    Forum Contributor
    Join Date
    04-21-2009
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    112

    Re: Option to hide the sheet when "Disable Macros" is clicked

    Dear Roy,

    Thanks for your tips

    But,the workbook which i am using is shared. The exaample is not working for me.

    Is ther any other method to automatically hide the sheet when "Disable macros" is clicked. At the same time when i click "Enable macros" my required sheet should open.

    Please tell me any other available procedures.

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Option to hide the sheet when "Disable Macros" is clicked

    You need to unshare a workbook before adding code to it. Once added you can then share the workbook again

  7. #7
    Forum Contributor
    Join Date
    04-21-2009
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    112

    Re: Option to hide the sheet when "Disable Macros" is clicked

    Dear Roy,

    I have unshared the workbook. then after saving changes i shared the workbook again.Even then its not working.

  8. #8
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Option to hide the sheet when "Disable Macros" is clicked

    It works for me

  9. #9
    Forum Contributor
    Join Date
    04-21-2009
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    112

    Re: Option to hide the sheet when "Disable Macros" is clicked

    Hello Domini,
    Thanks for your help.
    The example works fine. But Macros work for both the conidtions.
    I.e when "Disabled or " Enabled" the sheets gets hidden.

    But my rerquirement is the sheet should be hidden only when i click "Disable macros".

    Any solutions!!!!


    Alex

  10. #10
    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: Option to hide the sheet when "Disable Macros" is clicked

    You can't hide a sheet via a macro if macros are disabled; that's why it has to be hidden beforehand, and then unhidden (by a macro) when macros are enabled.
    Entia non sunt multiplicanda sine necessitate

+ 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