I have an excel add-in that has a custom tab on the ribbon, and on this tab is a toggle button. The only action that occurs when the toggle button is pressed is that a cell is set equal to false or true.
The state of the cell linked to the toggle button affects what procedures occur when a macro is run.
My problem is that certain procedures should not be run while the toggle button is pressed. If the user forgets to unpress the toggle button when performing one of these procedures I would like to automatically unpress the button. It is easy to set the affected cell = false, but I would like the state of the cell and the toggle button to match. Does anyone know how to access and press a toggle button on the excel 2007 ribbon from a macro?
Thank you in advance.
Code:
Sub Toggle_is_clicked(control As IRibbonControl, pressed As Boolean)
Dim ws As Worksheet
Set ws = ActiveWorkbook.Worksheets(1)
If pressed = True Then
ws.Cells(1, 11) = True
Else
ws.Cells(1, 11) = False
End If
End Sub
The state of the cell linked to the toggle button affects what procedures occur when a macro is run.
My problem is that certain procedures should not be run while the toggle button is pressed. If the user forgets to unpress the toggle button when performing one of these procedures I would like to automatically unpress the button. It is easy to set the affected cell = false, but I would like the state of the cell and the toggle button to match. Does anyone know how to access and press a toggle button on the excel 2007 ribbon from a macro?
Thank you in advance.