PDA

View Full Version : Custom Ribbon Toggle Button Across Multiple Documents



Jfp87
03-28-2017, 01:10 AM
Guys,

I have a custom ribbon with a toggle button that highlights Content Controls. If I have multiple documents open, how do I force the ribbon button to be toggled across all documents? I.e. you have two open documents and you toggle the setting it one but it affects both.


Public myRibbon As IRibbonUI


'Callback for Toogle onActionSub ToggleonAction(control As IRibbonControl, pressed As Boolean)
Select Case control.ID
Case Is = "Grp1TB1"
If p_bHighlight Then
p_bHighlight = False
Else
p_bHighlight = True
End If
modMain.HighlightVariables
Case Else
'Do nothing
End Select
'Force the ribbon to redefine the control with correct image and label
myRibbon.InvalidateControl control.ID
End Sub

Will I need to declare multiple ribbon instances?

Joe

gmaxey
03-28-2017, 04:22 AM
Joe,

When you load your ribbon as an add-in it already performs like that. Does it not?

Jfp87
03-28-2017, 07:38 AM
Sorry Greg, my mistake. It does.

I was getting confused because the actual toggle button isn't changed instantaneously throughout all documents. The toggle action does take place through all open docs and the button itself is changed when you click into another document.

Joe