Hide Sheet tabs view completely

JackDanIce

Well-known Member
Joined
Feb 3, 2010
Messages
9,922
Office Version
  1. 365
Platform
  1. Windows
Hi,

Have code that hides the sheet tabs:
Code:
ActiveWindow.DisplayWorkbookTabs = False
Unfortunately, the User can change this via: Excel Options->Advanced, section Display.

Is there anyway to prevent the user re-enabling the display of workbook tabs?

In this instance Sheet.Visible = xlSheetVeryHidden won't suffice.

Suggestions, workarounds (or accurately predicted lottery numbers), replies welcome,
Jack
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Q What exactly are you trying to achieve?
eg are you trying to prevent a user being able to right-click on sheet tab? - if so see post#3

In the meantime ... try this sledge-hammer approach (does not prevent the user amending the option but the next action reverses it!)

Place these in ThisWorkbook module (NOT in a standard module, NOT in a sheet module)
Code:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
    HideTabs
End Sub
Private Sub Workbook_NewSheet(ByVal Sh As Object)
    HideTabs
End Sub
Private Sub Workbook_Open()
    HideTabs
End Sub
Private Sub Workbook_SheetCalculate(ByVal Sh As Object)
    HideTabs
End Sub
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
    HideTabs
End Sub
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
    HideTabs
End Sub
Private Sub Workbook_WindowActivate(ByVal Wn As Window)
    HideTabs
End Sub
Private Sub HideTabs()
    ActiveWindow.DisplayWorkbookTabs = False
End Sub
 
Last edited:
Upvote 0
To disable the context menu which appears when user right-clicks on sheet tab

Place code in ThisWorkbook module
Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
    Application.CommandBars("Ply").Enabled = True
End Sub
 
Private Sub Workbook_Open()
    Application.CommandBars("Ply").Enabled = False
End Sub
 
Upvote 0
@Yongle, thank you for replying but I think you've missed what I asked which is preventing the User changing the view of displayed tabs - not changing menu options or using xlSheetVeryHidden

Already manipulating lots of menu disables and right-click features. Trying to avoid including more of this in the code.

Your sledge hammer code, I already stated it as being in code. I didn't include Sub and End Sub as it seemed superfluous, and generally speaking if it's already in code, then it's going to be in the relevant event procedure.

Hiding the entire sheet tabs (& preventing User unhiding) will save a lot of other control options and reduce the code - that is why I tried to be specific with the question :)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top