OaklandJim
Well-known Member
- Joined
- Nov 29, 2018
- Messages
- 855
- Office Version
- 365
- Platform
- Windows
Team Ribbon
I have read suggested materials from de Bruin, Pope, etc. I keep learning parts of the story. I figger that I'm 30% there. But so much to understand... Right now trying to be more familiar with the callback stuff. It is all somewhat confusing, to me at least.
First, based on examples I am creating a file named Excel.officeUI in dir C:\Users\Jim\AppData\Local\Microsoft\Office\.
I read about another way to do implement the ribbon using customUI.xml (=xl 2007?) and customUI14.xml (>xl2010). I'm not sure what to do with those files. Of course generating the xml is the first step and not very difficult but what next? Is there a resource that describes implementation of these.
My approach seems to work sluggishly. After I run code that creates the Excel.officeUI I have to touch the VBA editor before the ribbon shows up. Even if I use the example clear ribbon code (that does return file to it's bare bones state as shown just below) the ribbon is still visible. I suppose that closing and clearing the file then reopening the file will work.
Eventually I'm hoping for event code that shows or removes the custom ribbon tab when changing worksheets.
Currently I am having difficulty understanding BASIC chekboxes and dropdowns. I generated the code below but nothing happens when I click the controls on the ribbon. Screentips work. I can check/uncheck the chekbox but cannot get any vba routines to fire. No items are shown in the dropdown and no code fires.
I do have the subs named in the controls' definitions but they do not fire at all. I bet that I missed something fundamental.
I have read suggested materials from de Bruin, Pope, etc. I keep learning parts of the story. I figger that I'm 30% there. But so much to understand... Right now trying to be more familiar with the callback stuff. It is all somewhat confusing, to me at least.
First, based on examples I am creating a file named Excel.officeUI in dir C:\Users\Jim\AppData\Local\Microsoft\Office\.
I read about another way to do implement the ribbon using customUI.xml (=xl 2007?) and customUI14.xml (>xl2010). I'm not sure what to do with those files. Of course generating the xml is the first step and not very difficult but what next? Is there a resource that describes implementation of these.
My approach seems to work sluggishly. After I run code that creates the Excel.officeUI I have to touch the VBA editor before the ribbon shows up. Even if I use the example clear ribbon code (that does return file to it's bare bones state as shown just below) the ribbon is still visible. I suppose that closing and clearing the file then reopening the file will work.
XML:
<mso:customUI xmlns:mso="http://schemas.microsoft.com/office/2009/07/customui"><mso:ribbon></mso:ribbon></mso:customUI>
Eventually I'm hoping for event code that shows or removes the custom ribbon tab when changing worksheets.
Currently I am having difficulty understanding BASIC chekboxes and dropdowns. I generated the code below but nothing happens when I click the controls on the ribbon. Screentips work. I can check/uncheck the chekbox but cannot get any vba routines to fire. No items are shown in the dropdown and no code fires.
XML:
<mso:customUI xmlns:mso='http://schemas.microsoft.com/office/2009/07/customui'>
<mso:ribbon>
<mso:qat/>
<mso:tabs>
<mso:tab id='tab1' label='Test Ribbon' insertBeforeQ='mso:TabFormat'>
<mso:group id='group4' label='Toggle Visible' autoScale='true'>
<mso:checkBox id='G4Checkbox1' label='Dates' onAction='G4_Checkbox1_Selected' getPressed='G4_Checkbox1_Pressed' screentip='Hide dates column.'/>
</mso:group>
<mso:group id='group5' label='Select Color' autoScale='true'>
<mso:dropDown id='G5Dropdown1' label='Select Primary' onAction='G5_Dropdown1_Selected' screentip='Select the preferred primary color.'/>
<mso:item id='G5Item1' label='Blue'/>
<mso:item id='G5Item2' label='Red'/>
<mso:item id='G5Item3' label='Green'/>
</mso:group>
</mso:tab>
</mso:tabs>
</mso:ribbon>
</mso:customUI>
I do have the subs named in the controls' definitions but they do not fire at all. I bet that I missed something fundamental.
VBA Code:
Public Function G4_Checkbox1_Selected(pControl As IRibbonControl, ByRef pbPressedItem As Boolean)
MsgBox "Checkbox G4 1 toggled, pbPressedItem = " & pbPressedItem
End Function
Public Function G4_Checkbox1_Pressed(pControl As IRibbonControl, ByRef pvPressedItem As Variant)
MsgBox "Checkbox G4 1 pressed, pvPressedItem = " & pvPressedItem
End Function
Public Function G5_Dropdown1_Selected( _
ByRef control As Office.IRibbonControl, _
ByRef dropdownID As String, _
ByRef selectedIndex As Variant)
MsgBox "Dropdown G5-1 selected item, selectedIndex = " & selectedIndex
End Function
Public Function G5_Item1()
MsgBox "ItemG5_1 selected"
End Function
Public Function G5_Item2()
MsgBox "ItemG5_2 selected"
End Function
Public Function G5_Item3()
MsgBox "ItemG5_3 selected"
End Function