Get state of toggleButton in custom Excel Ribbon?

JanKb

New Member
Joined
Feb 4, 2021
Messages
1
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hey everyone,

I've been trying to solve the problem for a while now, but I cannot find a suitable solution online.

I have created a custom Ribbon which is loaded as an Add-In into my Workbooks. In this Ribbon I have a Toggle Button A and some other button, let's call it Button B. What I need is the follwing:

When pressing Button B, a specified procedure is taking place. During this procedure I need to know whether the Toggle Button A is pressed or not. Is there any way / function to easily read the stat of the button? I already tried to declare a boolean to store the value each time the toggle button is pressed (onAction), but unfortunately the variable is not stored in each Workbook seperately. So if I have two Workbooks open, it might happen that the toggle button is pressed, but the variable is false as this is the state in another Workbook.

Maybe anyone has a clever solution for this. It seems like a basic problem to me, to read the state of a button, but I still can't find a solution.

Many thanks and best regards,
Jan
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Depending on the conditions you use to determine the Pressed state of the button you can use the Activeworkbook object in your callback.
Another way is to use a 2D array type variable and to store the workbook name along with the button pressed state.
 
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,728
Members
448,987
Latest member
marion_davis

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