vba 如何使用 customUI 编辑器在 Excel 2013 中定义按钮的大小
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18773959/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to define size of a button in Excel 2013 using customUI editor
提问by Vatsa
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 layoutand How to add a custom Ribbon tab using VBA?
我正在尝试在 Excel 2013 中创建一个带有 2 个按钮的新功能区。由于Excel CustomUI 功能区布局和如何使用 VBA 添加自定义功能区选项卡,我能够使用自定义 UI 编辑器创建它 ?
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.htmas well, but the code looks the same. Any help will be appreciated. Thanks
然后单击 customUI 中的验证,它说“未声明大小属性”。我不确定要添加什么。我也看到了http://www.rondebruin.nl/win/s2/win009.htm,但代码看起来一样。任何帮助将不胜感激。谢谢
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>
回答by PatricK
Give this a try using built in icons from Office (get rid of buttonGroup
)
尝试使用 Office 中的内置图标(去掉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