sunriderdabi

New Member
Joined
Mar 10, 2019
Messages
1
Hi,

I am trying to set up a checkbox in the ribbon that activates/deactivates iterative calculations.

I manage to get this working. However, I don't manage to update the status of the checkbox if "iterative calculation" status is changed in Excel settings. I can have iterative calculations off while the checbox is on.

Any help is much appreciated, please see simple code below:


Sub IterationCalculations(control As IRibbonControl, pressed As Boolean)
If pressed = True Then
Application.Iteration = True
Else
Application.Iteration = False
End If
End Sub

Sub IsIteraToggled(control As IRibbonControl, ByRef returnedVal)
If Application.Iteration = True Then returnedVal = True
If Application.Iteration = False Then returnedVal = False
End Sub
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
I believe you should include the OnAction callback, and maybe name the callback to be clear what they do.
if the first sub is you OnAction Callback it may only contain one line (you don't need if).
Code:
[COLOR=#333333]Sub IterationCalculations(control As IRibbonControl, pressed As Boolean)[/COLOR]
[COLOR=#333333]    Application.Iteration = pressed[/COLOR]
[COLOR=#333333]End Sub[/COLOR]
The same goes for the second sub. The second must be called by the getPressed callback: it must be assigned to getPressed in the ribbon XML
if you want to call it during runtime (after the ribbon is loaded) (for testing purposes in this case) try this:
Code:
objRibbon.InvalidateControl "[I]YourCheckBoxControlName[/I]"
this will make it get it's value again.
of course you must have assigned the ribbon object to objRibbon at ribbon loading time, to be able to refer to it.
 
Upvote 0

Forum statistics

Threads
1,214,987
Messages
6,122,614
Members
449,091
Latest member
gaurav_7829

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