Home > database >  What is idMso (Name) of `new sheet button` Sign , which found on excel taskbar , Please see attach
What is idMso (Name) of `new sheet button` Sign , which found on excel taskbar , Please see attach

Time:01-21

I need to know the idMso (Name) of new sheet button Sign , which found on excel taskbar.
Purpose: I have a workbook which used by many users , and they click by mistake this Sign and create a lot of new sheets.
All the available methods depend on deleting the new created sheet or make it very hidden.
So, I want to use OfficeRibbonXEditor to disable this control completely (only in that workbook).
I managed to found those idMso SheetInsert and SheetInsertPage
But, they are only disable Button insert sheet (found on Home Tab)
Thanks for any one can help. enter image description here

CodePudding user response:

As you already need macros for unhiding sheets you could unprotect the workbook temporarily as well:

Option Explicit
Option Private Module

Private Const pwd As String = "test"  '<--- adjust this to your needs

Public Sub unhideSheet(ws As Worksheet)
unlockWorkbook
   ws.Visible = xlSheetVisible
lockWorkbook
End Sub

Public Sub hideSheet(ws As Worksheet)
unlockWorkbook
   ws.Visible = xlSheetVeryHidden
lockWorkbook
End Sub


Private Sub lockWorkbook()
ThisWorkbook.Protect Password:=pwd, Structure:=True, Windows:=False
End Sub

Private Sub unlockWorkbook()
ThisWorkbook.Unprotect Password:=pwd
End Sub

Moreover you could call lockWorkbook from the Workbook_Open and Workbook_BeforeClose events to be on the safe side.

CodePudding user response:

The Fluent UI (aka Ribbon UI) extensibility model doesn't provide anything for that. The best what you could do is to try using Windows API functions to subclass the Excel windows. Read more about the Ribbon UI in the following articles:

  •  Tags:  
  • Related