Stephen W Allen
New Member
- Joined
- Jul 21, 2021
- Messages
- 20
- Office Version
- 2019
- Platform
- Windows
This process is being run from an Add-In rather than a macro enabled workbook.
I have generated a custom UI Ribbon, where the controls of the ribbon are enabled/disabled depending on the workbook environment. Essentially, if the workbook, on being opened, contains a named control worksheet then most of the UI controls are enabled, otherwise they aren’t.
As a secondary control, I also want to handle the case where the named control worksheet is, or becomes, the active sheet. In this context, some of the Ribbon controls should remain enabled but others not.
I have a Class Module ready and waiting to trap the SheetActivate event and this passes information back to the “RibbonX” module. How can I re-run the UI Ribbon while the active workbook remains open?
I have generated a custom UI Ribbon, where the controls of the ribbon are enabled/disabled depending on the workbook environment. Essentially, if the workbook, on being opened, contains a named control worksheet then most of the UI controls are enabled, otherwise they aren’t.
As a secondary control, I also want to handle the case where the named control worksheet is, or becomes, the active sheet. In this context, some of the Ribbon controls should remain enabled but others not.
I have a Class Module ready and waiting to trap the SheetActivate event and this passes information back to the “RibbonX” module. How can I re-run the UI Ribbon while the active workbook remains open?
VBA Code:
Option Explicit
Public WithEvents xlApp As Application
Private Sub xlApp_SheetActivate(ByVal Sh As Object)
'If Test_CreateControl(ActiveWorkbook) = False Then
' MsgBox Sh.Name
'End If
Call Test_IsControlSheet(Sh)
End Sub