Excel/RibbonUI menu disabled - excel

Note The following problem was solved by creating a new workbook copying all the data, macros and other code across. Any insight into what causes a workbook to "break" would be welcome!
I have an excel file with a custom ribbonui. I've recently added a new group with a new menu, it (was) copied from the first group and certain items were removed.
The first group "library" and all its controls work as expected. The "documentmenu" menu in the "document" group however is grayed out and I cannot figure out why!
I've tried adding in a getEnabled and plain enabled attribute to the menu but it wont fire, neither will any of the getEnabled events for the menu's contained buttons.
When I open the ribbon for the first time the getLabel event does fire and sets the label correctly.
I've tried re-naming the group and all the controls to something without "document" in-case it's conflicting somehow, but again no go.
Does anyone know what might be causing this to happen?
Below is the entire customui xml file.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<customUI
onLoad="CustomUI.Ribbon_onLoad"
xmlns="http://schemas.microsoft.com/office/2009/07/customui">
<ribbon>
<tabs>
<tab
id="Main"
label="Initech">
<group
id="Library"
label="Library"
tag="Library"
centerVertically="true">
<menu
id="LibraryMenu"
tag="Library"
image="gear"
getLabel="CustomUI.Menu_getLabel">
<button
id="LibraryMenu_Open"
tag="Library"
label="Open Library"
imageMso="FileOpen"
getEnabled="CustomUI.Button_getEnabled"
onAction="CustomUI.Button_onAction" />
<button
id="LibraryMenu_New"
tag="Library"
label="New Library"
imageMso="FileNew"
getEnabled="CustomUI.Button_getEnabled"
onAction="CustomUI.Button_onAction" />
<menuSeparator
id="LibraryMenu_Separator0" />
<button
id="LibraryMenu_Save"
tag="Library"
label="Save"
imageMso="FileSave"
getEnabled="CustomUI.Button_getEnabled"
onAction="CustomUI.Button_onAction" />
<button
id="LibraryMenu_Close"
tag="Library"
label="Close"
imageMso="FileClose"
getEnabled="CustomUI.Button_getEnabled"
onAction="CustomUI.Button_onAction" />
<button
id="LibraryMenu_Default"
tag="Library"
label="Set as Default"
imageMso="AcceptInvitation"
getEnabled="CustomUI.Button_getEnabled"
onAction="CustomUI.Button_onAction" />
<menuSeparator
id="LibraryMenu_Separator1" />
<button
id="LibraryMenu_Add"
tag="Library"
label="Add Component"
getEnabled="CustomUI.Button_getEnabled"
onAction="CustomUI.Button_onAction" />
<button
id="LibraryMenu_Editor"
tag="Library"
label="Edit Menu"
getEnabled="CustomUI.Button_getEnabled"
onAction="CustomUI.Button_onAction" />
</menu>
<dynamicMenu
id="LibraryComponents"
tag="Library"
image="book_stack"
getLabel="CustomUI.Menu_getLabel"
getEnabled="CustomUI.Menu_getEnabled"
getContent="CustomUI.Menu_getContent" />
</group>
<group
id="Document"
label="Document"
tag="Document"
centerVertically="true">
<menu
id="DocumentMenu"
tag="Document"
imageMso="FileOpen"
getLabel="CustomUI.Menu_getLabel">
<button
id="DocumentMenu_Open"
tag="Document"
label="Open Document"
imageMso="FileOpen"
getEnabled="CustomUI.Button_getEnabled"
onAction="CustomUI.Button_onAction" />
<button
id="DocumentMenu_New"
tag="Document"
label="New Document"
imageMso="FileNew"
getEnabled="CustomUI.Button_getEnabled"
onAction="CustomUI.Button_onAction" />
<menuSeparator
id="DocumentMenu_Separator0" />
<button
id="DocumentMenu_Save"
tag="Document"
label="Save"
imageMso="FileSave"
getEnabled="CustomUI.Button_getEnabled"
onAction="CustomUI.Button_onAction" />
<button
id="DocumentMenu_Close"
tag="Document"
label="Close"
imageMso="FileClose"
getEnabled="CustomUI.Button_getEnabled"
onAction="CustomUI.Button_onAction" />
</menu>
</group>
</tab>
</tabs>
</ribbon>
</customUI>
Update after hours of playing about trying to figure out whats going on, turns out my workbook is damaged some how. The code works fine if I put it into a new workbook.

centerVertically is not a valid property.
Kindly refer this link
getEnabled="CustomUI.Button_getEnabled" & onAction="CustomUI.Button_onAction"
Avoid period . in name of callback function as we cannot define a sub/function like CustomUI.Button_getEnabled.
3 when using getEnabled attribute for a button a callback function is to be called when the application needs to determine the enabled state of the button.
sample code - getEnabled for ribbion

Related

Combining context menu with custom interface in Excel 365

I need to combine a custom ribbon with a context menu in an Excel file. I have been using custom ribbons and context menus with RibbonX separately for several years.
The code below doesn't seem to load either of them.
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
<ribbon>
<tabs>
<tab id="MyCustomTab" label="Client Tool" insertAfterMso="TabTEAM">
<group id="customGroup1" label="Add">
<button id="customButton1" label="New Product" size="large" onAction="NewProduct" />
<separator id="MySeparator1" />
<button id="customButton2" label="New Column" size="large" onAction="NewColumn" />
</group>
</tab>
</tabs>
</ribbon>
<contextMenus>
<contextMenu idMso="ContextMenuCell">
<menu id="MySubMenu" label="Client Menu" insertBeforeMso="Cut" image="clientlogo" >
<button id="Menu1Button1" label="Set as Relevant"
imageMso="AppointmentColor0" onAction="UpperMacro"/>
<button id="Menu1Button2" label="Set as Irrelevant"
imageMso="AppointmentColor4" onAction="LowerMacro"/>
</menu>
<menuSeparator id="MySeparator" insertBeforeMso="Cut" />
</contextMenu>
</contextMenus>
</customUI>

Excel Custom UI Editor For Microsoft Office Resizable buttons

I am trying to create custom ribbon tab in Excel with resizable buttons, based on the size of the window. I am using Custom UI Editor For Microsoft Office. I would like that the buttons will change to small when I shrink Excel, like they do in other tabs. The code that I wrote in Custom UI Editor For Microsoft Office is below. Here size is defined as large. Is it possible to set it as auto so it will change automatically based on the size of the window?
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
<ribbon>
<tabs>
<tab id="CustomTab" label="Custom Tab" insertAfterMso="TabView">
<group id="ImportRequestGroup" label="Import Requests" imageMso="Refresh">
<button id="RefreshButton" label="Refresh" size="large" onAction="RefreshAction" imageMso="Refresh" />
<button id="ImportRequestButton" label="Import Requests" size="large" onAction="ImportRequestAction" imageMso="OutlineDemoteToBodyText" />
</group>
<group id="ShowViewsGroup" label="Show views" imageMso="FrameCreateLeft">
<button id="ShowCalanderButton" label="Show Calander" size="large" onAction="ShowCalanderAction" imageMso="FrameCreateLeft" />
<button id="ViewPlanButton" label="View Plan" size="large" onAction="ViewPlanAction" imageMso="ViewFullScreenView" />
<button id="SortPlanButton" label="Sort Plan" size="large" onAction="SortPlanAction" imageMso="Bullets" />
<button id="FilterNoneButton" label="Filter none" size="large" onAction="FilterNoneAction" imageMso="FilterToggleFilter" />
<button id="HideAbsenceButton" label="Hide Absence" size="large" onAction="HideAbsenceAction" imageMso="CharacterBorder" />
</group>
<group id="ManageRowsGroup" label="Manage rows" imageMso="ActionInsertAccess">
<button id="InsertRowButton" label="Insert Row" size="large" onAction="InsertRowAction" imageMso="ActionInsertAccess" />
<button id="MoveToArchaveButton" label="Move to Archave" size="large" onAction="MoveToArchaveAction" imageMso="SourceControlCheckOut" />
</group>
<group id="EmailReportsGroup" label="Email reports" imageMso="ChangesDiscardAndRefresh">
<button id="CalculateDifferenceButton" label="Calculate Difference" size="large" onAction="CalculateDifferenceAction" imageMso="ChangesDiscardAndRefresh" />
<button id="DaysReminderButton" label="5 days Reminder" size="large" onAction="DaysReminderAction" imageMso="MailMergeStartEmail" />
</group>
<group id="ReportsGroup" label="Reports" imageMso="AcceptInvitation">
<button id="ApprovePlanButton" label="Approve Plan" size="large" onAction="ApprovePlanAction" imageMso="AcceptInvitation" />
<button id="Report14DaysButton" label="Report 14 days" size="large" onAction="Report14DaysAction" imageMso="ChooseForm" />
<button id="ReportTechnicianButton" label="Report Technician" size="large" onAction="ReportTechnicianAction" imageMso="CompareAndCombine" />
<button id="WeeklyViewButton" label="Weekly View" size="large" onAction="WeeklyViewAction" imageMso="GroupMarginsAndPadding" />
</group>
<group id="CheckDuplicatesGroup" label="Check duplicates" imageMso="OutlineUngroupMenu">
<button id="CheckEquipmenButton" label="Check Equipmen" size="large" onAction="CheckEquipmenAction" imageMso="OutlineUngroupMenu" />
<button id="CheckTechnicianButton" label="Check Technician" size="large" onAction="CheckTechnicianAction" imageMso="SharingOpenWssTaskList" />
</group>
<group id="SpotfireFilesGroup" label="Spotfire files" imageMso="Chart3DColumnChart">
<button id="SpotfirePlanAndArchiveButton" label="Spotfire Plan and Archive" size="large" onAction="SpotfirePlanAndArchiveAction" imageMso="Chart3DColumnChart" />
<button id="SpotfireRealizationReportButton" label="Spotfire Realization Report" size="large" onAction="SpotfireRealizationReportAction" imageMso="SharingOpenWssContactList" />
</group>
<group id="FormatingGroup" label="Formating" imageMso="AutoFormat">
<button id="ConditionalFormatingButton" label="Conditional Formating" size="large" onAction="ConditionalFormating" imageMso="AutoFormat" />
</group>
</tab>
</tabs>
</ribbon>
</customUI>
I tried to find the solution online with no luck.
Resizing custom controls is only available for Office 2010 and later. The functionality is somewhat limited for custom controls (as opposed to what Microsoft does with their own controls).
The capability can only be applied to group controls, not individual controls. The command is an attribute of the <group> tag. Example:
<group id="ImportRequestGroup" autoScale="true" label="Import Requests" imageMso="Refresh">
Microsoft Documentation reference:
https://learn.microsoft.com/en-us/previous-versions/office/developer/office-2010/ee691834(v=office.14)?redirectedfrom=MSDN#auto-scaling-of-custom-controls

How To Customize The Supertip Of An Excel Ribbon

I'm using the Custom UI Editor to customize my Excel ribbon with the following code:
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon startFromScratch="false">
<tabs>
<tab id="customTab" label="MyWorkbookTest">
<group id="customGroup1" label="Utilities">
<button id="customButton1" label="About" imageMso="ResultsPaneAccessibilityMoreInfo" size="large" supertip="View the framework version and status" onAction="ShowAbout" />
<button id="customButton2" label="Contact" imageMso="HyperlinkInsert" size="large" supertip="Launch the 'Contact Us' webpage" onAction="ShowContactUs" />
</group>
</tab>
</tabs>
</ribbon>
</customUI>
Can anyone tell me how to delete the part circled in red coming out automatically?
Result

Excel CustomUI ribbon layout

I'm trying to create a custom ribbon for excel with a group that looks like the image below. (2 rows of buttons with a dropdown box below).
I am beginning to think that it cant be done exactly how I'd like.
I have tried a few different ways (one of which is below) but they all result in the same output. 3 columns, 2x2 buttons with the dropdown box in the third column.
Does anyone know if this is possible?
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<customUI onLoad="Ribbon.onLoad" xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon>
<tabs>
<tab id="toolRibbon" label="redacted">
<group id="groupDocument" label="Secret Document">
<box id="z" boxStyle="vertical">
<box id="a" boxStyle="horizontal">
<box id="aa" boxStyle="vertical">
<button id="aaa" label="AAA" />
<button id="aab" label="AAB" />
</box>
<box id="ab" boxStyle="vertical">
<button id="aba" label="ABA" />
<button id="abb" label="ABB" />
</box>
</box>
<comboBox id="b" label="Looms">
<item id="ba" label="BA" />
<item id="bb" label="BB" />
<item id="bc" label="BC" />
</comboBox>
</box>
</group>
</tab>
</tabs>
</ribbon>
</customUI>
After looking through the available controls more thoroughly I found the buttonGroup which allows me to have buttons side-by-side.
Now to make them the right size..
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon>
<tabs>
<tab id="toolRibbon" label="redacted">
<group id="groupDocument" label="Specia; Document">
<buttonGroup id="a">
<button id="aa" label="AA"/>
<button id="ab" label="AB"/>
</buttonGroup>
<buttonGroup id="b" >
<button id="ba" label="BA"/>
<button id="bb" label="BB"/>
</buttonGroup>
<comboBox id="c" label="Looms">
<item id="ca" label="ca"/>
<item id="cb" label="cb"/>
<item id="cc" label="cc"/>
</comboBox>
</group>
</tab>
</tabs>
</ribbon>
</customUI>

Ribbon Contextual Groups and Tabs in SharePoint

I am new to SharePoint ribbon. Why do I not see the View and Edit buttons in the Manage group of my tab?
Here are my definitions for your reference:
<ContextualGroup Id="Ribbon.MyWorkContextualTabGroup"
Color="Blue" Title="{title}"
Command="MyWorkContextualTab.EnableContextualGroup"
Sequence="502"
ContextualGroupId="MyWorkContextualTabGroup">
<Tab Id="Ribbon.MyWorkTab"
Title="My Work"
Description="My Work tab description"
Command="MyWorkContextualTab.EnableMyWorkTab"
Sequence="501">
<Scaling Id="Ribbon.MyWorkTab.Scaling">
<MaxSize Id="Ribbon.MyWorkTab.MaxSize_New"
GroupId="Ribbon.MyWorkTab.MyWorkGroup_New"
Size="MyWorkLayout"
Sequence="10"/>
<MaxSize Id="Ribbon.MyWorkTab.MaxSize_Manage"
GroupId="Ribbon.MyWorkTab.MyWorkGroup_Manage"
Size="MyWorkLayout"
Sequence="20" />
<Scale Id="Ribbon.MyWorkTab.Scalling.MyWorkTabScalling_New"
GroupId="Ribbon.MyWorkTab.MyWorkGroup_New"
Size="MyWorkLayout"
Sequence="30" />
<Scale Id="Ribbon.MyWorkTab.Scalling.MyWorkTabScalling_Manage"
GroupId="Ribbon.MyWorkTab.MyWorkGroup_Manage"
Size="MyWorkLayout"
Sequence="40"/>
</Scaling>
<Groups Id="Ribbon.MyWorkTab.Groups">
<Group Id="Ribbon.MyWorkTab.MyWorkGroup_New"
Description="New group description"
Title="New"
Command="MyWorkContextualTab.EnableMyWorkGroup_New"
Sequence="52"
Template="Ribbon.Templates.MyWorkTemplate">
<Controls Id="Ribbon.MyWorkTab.MyWorkGroup_New.Controls">
<Button Id="Ribbon.MyWorkTab.MyWorkGroup_New.NewItem"
Command="MyWorkContextualTab.NewItemCommand"
Sequence="15"
Description="Add a new item"
LabelText="New Item"
TemplateAlias="ONE_R1"
Image32by32="_layouts/images/mywork/ribbon/newitem.png" />
</Controls>
</Group>
<Group Id="Ribbon.MyWorkTab.MyWorkGroup_Manage"
Description="Manage group description"
Title="Manage"
Command="MyWorkContextualTab.EnableMyWorkGroup_Manage"
Sequence="53"
Template="Ribbon.Templates.MyWorkTemplate">
<Controls Id="Ribbon.MyWorkTab.MyWorkGroup_Manage.Controls">
<Button Id="Ribbon.MyWorkTab.MyWorkGroup_Manage.ViewItem"
Command="MyWorkContextualTab.ViewItemCommand"
Sequence="25"
Description="View this item"
LabelText="View Item"
TemplateAlias="ONE_R1"
Image32by32="_layouts/images/mywork/ribbon/viewitem.png" />
<Button Id="Ribbon.MyWorkTab.MyWorkGroup_Manage.EditItem"
Command="MyWorkContextualTab.EditItemCommand"
Sequence="35"
Description="Edit this item"
LabelText="Edit Item"
TemplateAlias="ONE_R1"
Image32by32="_layouts/images/mywork/ribbon/edititem.png" />
</Controls>
</Group>
</Groups>
</Tab>
</ContextualGroup>
<GroupTemplate Id="Ribbon.Templates.MyWorkTemplate">
<Layout Title="MyWorkLayout" LayoutTitle="MyWorkLayout">
<Section Alignment="Top" Type="OneRow">
<Row>
<ControlRef DisplayMode="Large" TemplateAlias="ONE_R1"/>
</Row>
</Section>
<Section Alignment="Top" Type="ThreeRow">
<Row>
<ControlRef DisplayMode="Medium" TemplateAlias="THE_R1"/>
</Row>
<Row>
<ControlRef DisplayMode="Medium" TemplateAlias="THE_R2"/>
</Row>
<Row>
<ControlRef DisplayMode="Medium" TemplateAlias="THE_R3"/>
</Row>
</Section>
</Layout>
</GroupTemplate>
I havent worked with Sharepoint's Ribbon much, but from what I understand it is almost identical to CRM 2011 ribbon structure. When the issue of missing buttons crop up in CRM it is usually a sequence issue with Scaling and MaxSize.
All of the MaxSize element need to come before the Scale elements in terms of sequence. I would try adding the sequence numbers to the MaxSize/Scale elements in your Scaling section and adjust the numbers to make sure maxsize appears before scale.
Hope this helps.
example:
<Scaling Id="Ribbon.MyWorkTab.Scaling">
<MaxSize Id="Ribbon.MyWorkTab.MaxSize_New"
GroupId="Ribbon.MyWorkTab.MyWorkGroup_New"
Size="MyWorkLayout"
Sequence="10"/>
<MaxSize Id="Ribbon.MyWorkTab.MaxSize_Manage"
GroupId="Ribbon.MyWorkTab.MyWorkGroup_Manage"
Size="MyWorkLayout"
Sequence="20" />
<Scale Id="Ribbon.MyWorkTab.Scalling.MyWorkTabScalling_New"
GroupId="Ribbon.MyWorkTab.MyWorkGroup_New"
Size="MyWorkLayout"
Sequence="30" />
<Scale Id="Ribbon.MyWorkTab.Scalling.MyWorkTabScalling_Manage"
GroupId="Ribbon.MyWorkTab.MyWorkGroup_Manage"
Size="MyWorkLayout"
Sequence="40"/>
</Scaling>
Okay this is what I had to do:
Do not use _ (underscore) in the Id.
Change my layout to use OverflowSection
Here are my final definitions in case if you need:
<ContextualGroup Id="Ribbon.MyWorkContextualTabGroup"
Color="Blue" Title="{title}"
Command="MyWorkContextualTab.EnableContextualGroup"
Sequence="502"
ContextualGroupId="MyWorkContextualTabGroup">
<Tab Id="Ribbon.MyWorkTab"
Title="My Work"
Description="My Work tab description"
Command="MyWorkContextualTab.EnableMyWorkTab"
Sequence="501">
<Scaling Id="Ribbon.MyWorkTab.Scaling">
<MaxSize Id="Ribbon.MyWorkTab.MaxSizeNew"
GroupId="Ribbon.MyWorkTab.MyWorkGroupNew"
Size="MyWorkLayout"
Sequence="10"/>
<MaxSize Id="Ribbon.MyWorkTab.MaxSizeManage"
GroupId="Ribbon.MyWorkTab.MyWorkGroupManage"
Size="MyWorkLayout"
Sequence="20" />
<Scale Id="Ribbon.MyWorkTab.Scaling.MyWorkTabScalingNew"
GroupId="Ribbon.MyWorkTab.MyWorkGroupNew"
Size="MyWorkLayout"
Sequence="30" />
<Scale Id="Ribbon.MyWorkTab.Scaling.MyWorkTabScalingManage"
GroupId="Ribbon.MyWorkTab.MyWorkGroupManage"
Size="MyWorkLayout"
Sequence="40"/>
</Scaling>
<Groups Id="Ribbon.MyWorkTab.Groups">
<Group Id="Ribbon.MyWorkTab.MyWorkGroupNew"
Description="New group description"
Title="New"
Command="MyWorkContextualTab.EnableMyWorkGroupNew"
Sequence="52"
Template="Ribbon.Templates.MyWorkTemplate">
<Controls Id="Ribbon.MyWorkTab.MyWorkGroupNew.Controls">
<Button Id="Ribbon.MyWorkTab.MyWorkGroupNew.NewItem"
Command="MyWorkContextualTab.NewItemCommand"
Sequence="15"
Description="Add a new item"
LabelText="New Item"
TemplateAlias="ONERW"
Image32by32="_layouts/images/mywork/ribbon/newitem-32.png" />
</Controls>
</Group>
<Group Id="Ribbon.MyWorkTab.MyWorkGroupManage"
Description="Manage group description"
Title="Manage"
Command="MyWorkContextualTab.EnableMyWorkGroupManage"
Sequence="53"
Template="Ribbon.Templates.MyWorkTemplate">
<Controls Id="Ribbon.MyWorkTab.MyWorkGroupManage.Controls">
<Button Id="Ribbon.MyWorkTab.MyWorkGroupManage.ViewItem"
Command="MyWorkContextualTab.ViewItemCommand"
Sequence="25"
Description="View this item"
LabelText="View Item"
TemplateAlias="ONERW"
Image32by32="_layouts/images/mywork/ribbon/viewitem-32.png" />
<Button Id="Ribbon.MyWorkTab.MyWorkGroupManage.EditItem"
Command="MyWorkContextualTab.EditItemCommand"
Sequence="35"
Description="Edit this item"
LabelText="Edit Item"
TemplateAlias="ONERW"
Image32by32="_layouts/images/mywork/ribbon/edititem-32.png" />
</Controls>
</Group>
</Groups>
</Tab>
</ContextualGroup>
<GroupTemplate Id="Ribbon.Templates.MyWorkTemplate">
<Layout Title="MyWorkLayout" LayoutTitle="MyWorkLayout">
<OverflowSection Type="OneRow" DisplayMode="Large" TemplateAlias="ONERW"/>
</Layout>
</GroupTemplate>

Resources