I made a custom ribbon addin following this article,
https://www.thespreadsheetguru.com/blog/step-by-step-instructions-create-first-excel-ribbon-vba-addin
It works perfectly but can I move the tab which I have made to be the second tab after the Start tab?
You can do what you wish to do but to do so will mean that you need to edit the CustomUI.Xml file which is located in the zip file that is an Office document.
If you are working in VBA then you will best be served by the CustomUI editor tool
https://github.com/OfficeDev/office-custom-ui-editor
This tool will extract the xml file from an Office document, allow you to edit and then save it back to the office document.
This is a good link to start reading up on Ribbon Xml.
https://www.rondebruin.nl/win/s2/win001.htm
The Xml below is from one of my CustomUI for Word. I think it does the same as you are asking in that I inserts the new tab to the left of the Past group on the Home Tab of the ribbon. It also replaces the Paragraph tab with a customised version.
<tab
idMso="TabHome">
<group
id = "Home.RegulatoryCMC"
label = "Regulatory CMC"
insertBeforeMso = "GroupClipboard"
visible="true">
<button
id = "Home.RegulatoryCMC.StartHere"
label = "Start Here"
onAction = "RibbonCallbacksForButtons.OnAction"
getSupertip = "RibbonCallbacksForSupertips.getSuperTip"/>
<button
id="Home.RegulatoryCMC.ShowStylePane"
label="Show Style Pane"
onAction="RibbonCallbacksForButtons.onAction"
getSupertip = "RibbonCallbacksForSupertips.getSuperTip"/>
<button
id="Home.RegulatoryCMC.ResetXML"
label="Reset XML"
onAction="RibbonCallbacksForButtons.onAction"
getSupertip = "RibbonCallbacksForSupertips.getSuperTip"/>
</group>
<group
idMso="GroupParagraph"
getVisible="RibbonCallbacksForVisibility.getVisible"/>
<box
id="Home.Paragraph.Status"
boxStyle="horizontal">
<buttonGroup
id="Home.Paragraph.Alignment">
<toggleButton idMso="AlignLeft"/>
<toggleButton idMso="AlignCenter"/>
<toggleButton idMso="AlignRight"/>
<toggleButton idMso="AlignJustify"/>
</buttonGroup>
<buttonGroup
id="Home.Paragraph.Marks"
visible="true">
<toggleButton idMso="ParagraphMarks"/>
</buttonGroup>
</box>
<box
id="ParagraphIndent"
boxStyle="horizontal">
<button idMso="IndentDecreaseWord"/>
<button idMso="IndentIncreaseWord"/>
</box>
<box
id = "ParagraphOther"
boxStyle="horizontal">
<gallery idMso="LineSpacingGallery"/>
<button idMso="SortDialogClassic"/>
</box>
<dialogBoxLauncher>
<button idMso="ParagraphDialog"/>
</dialogBoxLauncher>
</group>
</tab>
Related
I wanted a small separator to appear between buttons in custom ribbon tab. But the <separator id="MySeparatorE1" /> always draws large vertical separator.
How can we get small separator as circled in picture to appear between the buttons ?
I want a small seperator between Sample1 and Sample2 of figure (In figure both are written sample though) !
</group>
<group id="customgroupF" label="EDIT SECTION">
<dropDown id="dropDownF1" label="Hello:" sizeString="B_300*300" getItemCount="GetItemCount1" getItemLabel="GetItemLabel1" onAction="onaction1" getSelectedItemIndex="ItemSelectedIndex1" />
<dropDown id="dropDownF2" label="Hi:" sizeString="C_300*300" getItemCount="GetItemCount2" getItemLabel="GetItemLabel2" onAction="onaction2" getSelectedItemIndex="ItemSelectedIndex2" />
<box id="box1" boxStyle="horizontal">
<button id="custombuttonF3" label="Sample1" screentip="Increase" onAction="Macro4" imageMso="UpArrow2" />
<button id="custombuttonF4" label="Sample2" screentip="Decrease" onAction="Macro4" imageMso="DownArrow2" />
</box>
<box id="box2" boxStyle="vertical">
<button id="custombuttonF1" label="Run1" showLabel="false" screentip="Edit1" onAction="Macro4" imageMso="MacroPlay" />
<button id="custombuttonF2" label="Run2" showLabel="false" screentip="Edit2" onAction="Macro4" imageMso="MacroPlay" />
</box>
</group>
By default, the Ribbon engine determines the positions of controls that you add to a group. If you want to define the layout of the controls with more precision, you can group the controls within one or more boxes. When you create a box, you specify its orientation (horizontal or vertical). A group can contain multiple boxes, and you can include vertical dividers between the boxes. The vertical dividers are created by using the separator control, which is used only for vertical boxes. For example:
<group id="CustomGroup2" label="Vertical Boxes"
insertBeforeMso="GroupClipboard">
<box id="box3" boxStyle="vertical">
<button id="buttonB1" label="Button1"/>
<button id="buttonB2" label="Button2"/>
</box>
<separator id="separator2"/>
<box id="box4" boxStyle="vertical">
<button id="buttonBA" label="ButtonA"/>
<button id="buttonBB" label="ButtonB"/>
<button id="buttonBC" label="ButtonC"/>
</box>
</group>
I have developed an excel Add-Ins which contains additional buttons with different function. My initial code was based on "Ron de Bruin Excel Automation" kit which worked great. (and I thank him for that). Recently I have added another group and a button, which worked fine on my excel (365 Excel version 2009), but failed on other machines with the same Excel version. The error was, it could not find any callbacks. I eliminated all callbacks but one "onAction" which is essential, but the error is still there.
Any help.
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon>
<tabs>
<tab id="CustomTab" label="שמאות מקרקעין" insertAfterMso="TabDeveloper">
<group id="GroupA" label="מידע נדלן רשות המיסים">
<button id="aButton01" label="יבא נתונים" onAction="RunMacro" imageMso="GetExternalDataImportClassic" size="large" />
<button id="aButton02" label="מזג גיליונות" onAction="RunMacro" imageMso="ReviewCombineRevisions" size="large" />
<button id="aButton03" label="מיין ומחק עמודות" onAction="RunMacro" imageMso="CreateQueryFromWizard" size="large" />
<button id="aButton04" label="שווי מר" onAction="RunMacro" imageMso="ConditionalFormattingAboveAverage" size="large" />
<button id="aButton05" label="התאמת משקל" onAction="RunMacro" imageMso="PageScaleToFitScale" size="large" />
<button id="aButton06" label="הכנה לדוח שומה" onAction="RunMacro" imageMso="MacroDefault" size="large" />
<button id="aButton07" label="תמונת הנכס" onAction="RunMacro" imageMso="PictureReflectionGallery" size="large" />
<button id="aButton08" label="וויסות הורדה אפשרויות" onAction="RunMacro" imageMso="StartTimer" size="large" />
<button id="aButton09" label="מחיר למשתכן" onAction="RunMacro" imageMso="TentativeAcceptInvitation" size="large" />
</group>
<group id="GroupB" label="תכנה">
<button id="bButton01" label="הוראות שימוש" onAction="RunMacro" imageMso="Help" size="large" />
<button id="bButton02" label="הזמנת רישיון" onAction="RunMacro" imageMso="GroupOmsInsert" size="large" />
<button id="bButton03" label="עידכון גירסה" onAction="RunMacro" imageMso="FillUp" size="large" />
<button id="bButton04" label="נתוני משתמש" onAction="RunMacro" imageMso="ArrangeByAccount" size="large" />
</group>
<group id="GroupC" label="נסח טאבו">
<button id="cButton01" label="PDF" onAction="RunMacro" imageMso="FileEmailAsPdfEmailAttachment" size="large" />
</group>
</tab>
</tabs>
</ribbon>
</customUI>
{
Sub RunMacro(control As IRibbonControl)
'PURPOSE: Tell each button which macro subroutine to run when clicked
Select Case control.ID
Case "aButton01": Application.Run "FromRibbon"
Case "aButton02": Application.Run "MergeSheetsmacro"
Case "aButton03": Application.Run "CleanColumns"
Case "aButton04": Application.Run "AddAverage"
Case "aButton05": Application.Run "Weight"
Case "aButton06": Application.Run "PrepareReport"
Case "aButton07": Application.Run "ActivateGoogleView"
Case "aButton08": Application.Run "GrabRegul"
Case "aButton09": Application.Run "MechirLamishtaken"
Case "bButton01": Application.Run "HelpForm"
Case "bButton02": Application.Run "LicenseRequest"
Case "bButton03": Application.Run "UpgradeVersion"
Case "bButton04": Application.Run "PersonalData"
Case "cButton01": Application.Run "ConvertPDF2Excel"
End Select
End Sub
}
enter code here
After a long trial an error process I found the reason to the effect . 64 bit vs. ,32 bit Office .
I have used some dll functions which were not properly defined for 64 office. As a result it corrupted the code.
Heylo, I am having a rather frustrating issue with my custom Excel Tab. I currently have about 20 buttons that all do a variety of different things, and I would like to implement some menu's to declutter the tab a bit. I have an add-in with a bunch of macros and an embedded customUI.xml file to organize all of the buttons.
The problem is, whenever I try to add what I see as perfectly fine menu xml code to the customUI.xml file, and re-embed it in the add-in, the tab ceases to show up when I reload Excel. Before I put the menu in, the tab is there and everything is fine, but when I add the menu code, it just doesn't want to show up anymore. Below is an example of what I'm trying to do.
<customUI xmlns = "http://schemas.microsoft.com/office/2006/01/customui">
<ribbon>
<tabs>
<tab id = "MyTab" label = "My Tab">
<group id = "About" label = "About">
<button id = "Button1"
label = "About My Tab"
size = "large"
onAction = "AboutMyTab"
imageMso = "Help"
screentip = "About My Tab"
supertip = "Shows a dialog box that displays information about My Tab."
/>
</group>
<group id = "TestMenus" label = "My Test Menu">
<menu id = "MyMenu" label = "The Menu">
<button id = "ButtonX" label = "X" size = "large" imageMso = "FileSave" />
<button id = "ButtonY" label = "Y" size = "large" imageMso = "Bold" />
<button id = "ButtonZ" label = "Z" size = "large" imageMso = "Undo" />
</menu>
</group>
</tab>
</tabs>
</ribbon>
</customUI>
Whether I embed the menu in a group or not, it still causes the tab to not show up at all. Is it the schema I am using? I am confused on what I am doing wrong. Also, I am using Excel 2016 if that helps in any way.
Thank you for any help in advance.
You need to remove Size property from buttons in menu and add it to menu itself:
<menu id = "MyMenu" label = "The Menu" itemSize = "large">
<button id = "ButtonX" label = "X" imageMso = "FileSave" />
<button id = "ButtonY" label = "Y" imageMso = "Bold" />
<button id = "ButtonZ" label = "Z" imageMso = "Undo" />
</menu>
I have defined my dialog view as follows. For some reason it gives blank dialog box. If I uncomment the already commented control and comment the entire , then it works fine. I do not understand what is possible problem with the . Same code works for another dialog with the
View.xml
<core:FragmentDefinition xmlns="sap.m" xmlns:core="sap.ui.core" xmlns:l="sap.ui.layout">
<Dialog id="editCompanyDialog" contentWidth="800px" contentHeight="100%" afterClose="onCancelEditCompanyDialog"
busy="{sharedApp>/oBusy/busy}" busyIndicatorDelay="{sharedApp/oBusy/delay}">
<!--<Toolbar class="modal-header">-->
<!-- <Text text="Edit Company Information" class="modal-title"/>-->
<!-- <core:Icon class="modal-logo" src="sap-icon://edit-icon"/>-->
<!-- <Button text="x" class="btn-link modal-close-button" press="onCancelEditCompanyDialog"/>-->
<!--</Toolbar>-->
<subHeader>
<Toolbar>
<Text class="sapUiSmallMarginBegin dialogTitle" text="{/headerText}"/>
<ToolbarSpacer></ToolbarSpacer>
<Button class="btn-link-grey" custdata:name="maDialog" icon="sap-icon://decline" tooltip="{i18n>GB_Close}" press="onCloseDialog"/>
</Toolbar>
</subHeader>
<Panel>
<content>
<l:BlockLayout id="editCompanyBlockLayout">
<l:BlockLayoutRow>
<l:BlockLayoutCell>
<VBox>
<ObjectIdentifier text="Edit your company information"/>
</VBox>
</l:BlockLayoutCell>
</l:BlockLayoutRow>
<l:BlockLayoutRow>
<l:BlockLayoutCell>
<VBox>
<Label text="{i18n>CC_Company}" labelFor="Name1"/>
<Input id="Name1" textAlign="Left" value="{EditCompany>/Input/Name1}" fieldGroupIds="FC"/>
</VBox>
</l:BlockLayoutCell>
</l:BlockLayoutRow>
</content>
</Panel>
In your button, you're using the custom data namespace, but haven't declared it.
Add
xmlns:custdata="http://schemas.sap.com/sapui5/extension/sap.ui.core.CustomData/1"
to the top of your view in the core:FragmentDefinition tag
I am trying to create a new ribbon with 2 buttons in Excel 2013. I was able to create it using Custom UI editor thanks to
Excel CustomUI ribbon layout and How to add a custom Ribbon tab using VBA?
When I input the code as
<button id="aa" label="CORE" onAction = "HMA_CORE"/>
it works but once I try this code
<button id="aa" label="CORE" size = "large" onAction = "HMA_CORE"/>
and then click validate in the customUI it says that "size attribute is not declared". I am not sure what to add. I saw http://www.rondebruin.nl/win/s2/win009.htm as well, but the code looks the same.
Any help will be appreciated.
Thanks
The code for the buttons looks like this
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon>
<tabs>
<tab id="toolRibbon" label="HMA-FUNCTIONS">
<group id="groupDocument" label="HMA-xml outputs">
<buttonGroup id="a">
<button id="aa" label="CORE" onAction = "HMA_CORE"/>
<button id="ab" label="PLANT" onAction = "HMA_PLANT"/>
</buttonGroup>
</group>
</tab>
</tabs>
</ribbon>
</customUI>
Give this a try using built in icons from Office (get rid of buttonGroup)
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon>
<tabs>
<tab id="toolRibbon" label="HMA-FUNCTIONS" insertBeforeMso="TabHome">
<group id="groupDocument" label="HMA-xml outputs">
<button id="aa" label="CORE" imageMso="MacroArguments" onAction = "HMA_CORE" size="large" />
<button id="ab" label="PLANT" imageMso="PictureBrightnessGallery" onAction = "HMA_PLANT" size="large" />
</group>
</tab>
</tabs>
</ribbon>
</customUI>
Reference: Office 2007 Icons Gallery
the problem was the space between the "size" and the "larger" statement! put it all together
error >> size = "larger"
correct >> size="larger"