PDA

View Full Version : Check/Uncheck all checkboxes with VBA



cagataybaser
09-05-2014, 06:03 AM
Hello everyone I am very new in website and Office 2007 Ribbon UI
I add two checkBoxes in the ribbon using xml (with Custom UI Editor for Microsoft Office) ,They execute vba code called KOLONAC and it works fine.What I need that is to check/uncheck all checkBoxes with another sub. My xml codes :

<checkBox id ="F20" label="F2" tag="F20" getPressed="GetPressed" onAction="KOLONAC" />
<checkBox id ="F21" label="F21" tag="F21" getPressed="GetPressed" onAction="KOLONAC" />


And I need to put some extra code inside of this sub to uncheck all checkboxes


Sub Button29_Click(control As IRibbonControl)
Sheets("Main Sheet").Columns("B:ZZ").Hidden = True
'some code too add here to uncheck all checkboxes
End Sub

I will be really really happy if you help me.

Paul_Hossler
06-01-2015, 06:14 PM
1. Your XML will need the onLoad to set a VBA IRibbon object (e.g. oRibbon)

2. I'd keep the check box status in a Boolean bF20, bF21, etc. so you need to change KOLONAC

3. Inside Button29_CLick I'd add

bF20 = False
bF21 = False
...

oRibbon.Invalidate



Here's something that uses TobbleButtons, but the concept is the same

http://www.vbaexpress.com/forum/showthread.php?52762-Something-wrong-in-XML-Or-in-VBA-Or-something-missing-anywhere

ketonen
01-27-2016, 10:52 AM
Tanks for help!