ToggleButton on the Ribbon

Stevenn

Active Member
Joined
Feb 8, 2012
Messages
259
I've made a togglebutton on the ribbon in Excel 2007, but I don't know how to check whether the button is pressed or not in a module.

Does anyone know how to handle this problem?
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
the callback for the togglebutton provides the state. if you need to check that from an unrelated procedure, then the onAction callback needs to store the value in a variable (or cell) that you can check later.
 
Upvote 0
Right now my onAction procedure looks like

Code:
Public Sub Toggle_is_clicked(Control As IRibbonControl, pressed As Boolean)
    If pressed Then
        Range("use_forms").Value = 1
    Else
        Range("use_forms").Value = 0
    End If
End Sub

but I don't want to store it in a cell. What is the alternative?
 
Upvote 0
you can store it in a variable instead (declared outside the callback so that it retains its value) or in the registry or a text file.
 
Upvote 0
you can store it in a variable instead (declared outside the callback so that it retains its value) or in the registry or a text file.

Isn't it possible to store values in the ribbon? I would have thought it was possible to store values just like it's possible to store font type, font size in the Home tab.
 
Upvote 0
if that worked, and you could then retrieve the values, you wouldn't need to do it since you could just read the state of the togglebutton directly.
 
Upvote 0

Forum statistics

Threads
1,214,827
Messages
6,121,823
Members
449,049
Latest member
cybersurfer5000

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