Roger
asked on
vba excel RibbonX: Stepwise-access to controls within a single group or tab
This is a request for pointers toward solutions, so I can chase or ask about details.
I have a two stage process (StepA; StepB), controlled respectively by Macros A and B. I'd like to run the macros from the Fluent ribbon, off two controls ButtonA and ButtonB, in the same Tab.
It is simple to have button A visible then the tab is active.
But I'd like button B ONLY to work (be visible/be enabled) when Button A has been clicked.
I control the Tab and ButtonA off getVisible and tag values
I have sought a means to control ButtonB off its control.ID, but there is no controls collection through which I might set ButtonB as visible (and hopefully render ButtonA invisible when step B is initiated). I dont need to collect 'pressed' data from the buttons
Can RibbonX buttons be controlled like this, or is there another 'dynamic' approach?
I have tried using a toggle button to deliver 'two stage' control. But was concerned that he user-driven processes that occur in step A, might somehow lift the focus from the toggle button before stepA was complete. Perhaps I should return to it..
... but finally, I've heard that windows task panes provide more dynamic properties and can replace dynamic userForms, and utilise their vba. Is this so?
PS I dont use visual studio..
Thanks, Kelvin
I have a two stage process (StepA; StepB), controlled respectively by Macros A and B. I'd like to run the macros from the Fluent ribbon, off two controls ButtonA and ButtonB, in the same Tab.
It is simple to have button A visible then the tab is active.
But I'd like button B ONLY to work (be visible/be enabled) when Button A has been clicked.
I control the Tab and ButtonA off getVisible and tag values
I have sought a means to control ButtonB off its control.ID, but there is no controls collection through which I might set ButtonB as visible (and hopefully render ButtonA invisible when step B is initiated). I dont need to collect 'pressed' data from the buttons
Can RibbonX buttons be controlled like this, or is there another 'dynamic' approach?
I have tried using a toggle button to deliver 'two stage' control. But was concerned that he user-driven processes that occur in step A, might somehow lift the focus from the toggle button before stepA was complete. Perhaps I should return to it..
... but finally, I've heard that windows task panes provide more dynamic properties and can replace dynamic userForms, and utilise their vba. Is this so?
PS I dont use visual studio..
Thanks, Kelvin
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks.
I've been working from deBruin's files, and so have a reference to the RibbonUI object:
Sub RibbonOnLoad(ribbon As IRibbonUI)
Set Rib = ribbon
End Sub
and use Rib.Invalidate:
Sub RefreshRibbon(Tag As String)
MyTag = Tag
If Rib Is Nothing Then
MsgBox "Error, restart your workbook"
Else
Rib.Invalidate
End If
End Sub
You refer to: " use a variable that macro A sets to True, then invalidates the control for B, whose callback simply checks the value of the variable set by A"
The only variables I have used with getVisible/getEnabled callbacks are Tag values and control.Ids. I dont know how to enable the callBack in B to check the boolean variable created by macroA?
Thanks..
I've been working from deBruin's files, and so have a reference to the RibbonUI object:
Sub RibbonOnLoad(ribbon As IRibbonUI)
Set Rib = ribbon
End Sub
and use Rib.Invalidate:
Sub RefreshRibbon(Tag As String)
MyTag = Tag
If Rib Is Nothing Then
MsgBox "Error, restart your workbook"
Else
Rib.Invalidate
End If
End Sub
You refer to: " use a variable that macro A sets to True, then invalidates the control for B, whose callback simply checks the value of the variable set by A"
The only variables I have used with getVisible/getEnabled callbacks are Tag values and control.Ids. I dont know how to enable the callBack in B to check the boolean variable created by macroA?
Thanks..
ASKER
Thanks for example, looking..
ASKER
rorya: EXCELLENT
Thanks for so rapidly showing me where the gap was!
Kelvin
Thanks for so rapidly showing me where the gap was!
Kelvin
Once you have that you could use a variable that macro A sets to True, then invalidates the control for B, whose callback simply checks the value of the variable set by A to see if button B should be enabled.
If you haven't already checked it out, Ron de Bruin's site has a lot of examples for the Ribbon: http://www.rondebruin.nl/win/s2/win001.htm