Consulting

Results 1 to 5 of 5

Thread: Permanently Hide Sheet Tabs

  1. #1
    VBAX Regular
    Joined
    May 2009
    Posts
    15
    Location

    Question Permanently Hide Sheet Tabs

    I have a shared workbook that I manage. Users navigate through the workbook with the links that I built. So I hide the sheet tabs so that they have to use the built navigation. But I then realized they can change the option to view sheet tabs through Tools>Options>View>Sheet Tabs. What VBA code could I put into the This Workbook
    module to automatically and permanently hide the sheet tabs when the workbook is opened?

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    Worksheets("Sheet1").Visible = xlSheetVeryHidden
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Regular
    Joined
    May 2009
    Posts
    15
    Location
    But then the user wont be able to access the sheets through the navigation.

    Quote Originally Posted by xld
    [vba]

    Worksheets("Sheet1").Visible = xlSheetVeryHidden
    [/vba]

  4. #4
    Knowledge Base Approver VBAX Guru GTO's Avatar
    Joined
    Sep 2008
    Posts
    3,368
    Location
    Quote Originally Posted by melsahn
    ...What VBA code could I put into the This Workbook
    module to automatically and permanently hide the sheet tabs when the workbook is opened?
    Greetings Melsahn,

    I think/hope I understand what you are saying, that being that you are depending upon the sheet tabs being hidden in order to exercise some control over the user's operations in the wb.

    The trouble is that if you record a macro to hide the tabs, here is what you get:
    [vba]
    ActiveWindow.DisplayWorkbookTabs = False
    [/vba]

    So see, the .DisplayWorkbookTabs belongs to the Window object, and thus is easily 'beaten'. For instance, if with the tabs hidden, the user goes to the menubar, Window|New Window, the new window will display the tabs.

    Or... Edit|Go To..., and tyoe in SHeet2!A1.

    You would be better served to change tactics as Bob (xld) suggested.

    Mark

  5. #5
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,876
    It is likely that if you change the way you hide sheets, you'll have to change the way you unhide them.
    Post your code?


    Quote Originally Posted by melsahn
    But then the user wont be able to access the sheets through the navigation.
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •