Hi All,
I'm using the following code to open specific ribbons based on the Worksheet name (I've setup my RibbonUI's in the XML already).
The code below opens up a particular ribbon based on the Worksheet Name or "CodeName" i.e. Sheet2:
Or I could use the WorkSheet Name i.e. Environment as below with the same code:
This code looks to the Sheet Name\Sheet Code Name and then calls the relevent RibbonUI that I've created. The thing that's giving me trouble is that I can't seem to use a wildcard for something similar to this:
I need this type of functionality as Users will make copies of this Worksheet and rename it to Release Plan Ver Draft 0.2\0.3\0.4 etc. The reason for changing the ribbon is that several macros on the Release Ribbon will error if they are used on the wrong Worksheet and possible corrupt data.
If anyone has any ideas how I could get this to work I would be very appreciative.
Many thanks,
Mark.
I'm using the following code to open specific ribbons based on the Worksheet name (I've setup my RibbonUI's in the XML already).
The code below opens up a particular ribbon based on the Worksheet Name or "CodeName" i.e. Sheet2:
Code:
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Select Case Sh.CodeName
Case "Sheet2": Call RefreshRibbon(Tag:="Environment")
Case "Sheet3": Call RefreshRibbon(Tag:="Release")
Case Else: Call RefreshRibbon(Tag:="")
End Select
End Sub
Code:
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Select Case Sh.Name
Case "Environment": Call RefreshRibbon(Tag:="Environment")
Case "Release Plan Ver Draft 0.1": Call RefreshRibbon(Tag:="Release")
Case Else: Call RefreshRibbon(Tag:="")
End Select
End Sub
Code:
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Select Case Sh.Name
Case "Environment": Call RefreshRibbon(Tag:="Environment")
Case "[B]Release Plan Ver *[/B]": Call RefreshRibbon(Tag:="Release")
If anyone has any ideas how I could get this to work I would be very appreciative.
Many thanks,
Mark.
Last edited: