Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi guys
In XL2003 with custom toolbars, I could assign an OnAction macro with an argument, something like .OnAction = "'MyMacro "SomeArgumentHere"'" From memory, the argument is wrapped in double quotes, the entire macro and argument is wrapped in single quotes and double quotes around that. It might have been slightly different, but you get the idea. What I'm trying to do now is, in XL2007, customise the ribbon similarly. But the syntax in XML is different and I'm wondering how you wrap the argument. Any suggestions are appreciated. Thanks in advance Paul Martin Melbourne, Australia |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks for the reply Andy, though I don't fully understand your
suggestion. What I'm trying to do is capture the user's selection in a combobox and use that selection as the criteria for what a procedure performs. Any suggestions? Thanks in advance Paul |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
So if I understand, you have a button that will run different macros depending upon the current selected item of a dropdown control. In which case you need to use a call back to get the dropdown item. vba code. Public Sub Dropdown1_onAction(control As IRibbonControl, id As String, index As Integer) ' ' Code for onAction callback. Ribbon control dropDown ' MsgBox "You selected ID=" & id & vbLf & "Index=" & index, vbInformation, "onAction Callback" End Sub xml for new group on home tab. Dropdown has 3 items, Cat, Dog and Fish. <!--RibbonX Visual Designer 1.6 for Microsoft Excel. XML Code produced on 2009/11/18-- <customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" <ribbon <tabs <tab idMso="TabHome" <group id="Group1" label="Group1" <dropDown id="Dropdown1" label="Pick Me" getItemLabel="Dropdown1_getItemLabel" onAction="Dropdown1_onAction" <item id="itmCat" label="Cat"/ <item id="itmDog" label="Dog"/ <item id="itmFish" label="Fish"/ </dropDown </group </tab </tabs </ribbon </customUI Cheers Andy -- Andy Pope, Microsoft MVP - Excel http://www.andypope.info "Paul Martin" wrote in message ... Thanks for the reply Andy, though I don't fully understand your suggestion. What I'm trying to do is capture the user's selection in a combobox and use that selection as the criteria for what a procedure performs. Any suggestions? Thanks in advance Paul |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Andy. I'm actually working through your Ribbon Add-In, which
looks very useful. I'll post back if I get stuck. Thanks again. Paul |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
FWIW, I didn't really like the idea of using the Tag property.
Initially it looked like a quick-fix, but an unnecessary one. Having selected a dropdown item, surely there's a way of capturing that selection without having to double-handle the value by entering it in the XML as a Tag property. My dropdowns are populated by values in cell ranges so, given that the dropdown captures the selection's index (base 0), I can use index + 1 as the pointer to the cell in the range. Hopefully that might assist someone who is searching for a solution to my problem. Paul |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Assign Macro to Ribbon Button | Excel Programming | |||
no custom button in ribbon | Excel Programming | |||
Macro Fault on Custom Ribbon | Excel Programming | |||
error running macro from Ribbon button | Excel Programming | |||
Hyperlink calls macro passing argument | Excel Programming |