【问题标题】:Adding MSO Gallery command to custom PowerPoint Ribbon将 MSO 库命令添加到自定义 PowerPoint 功能区
【发布时间】:2014-09-02 12:52:05
【问题描述】:

我在 PowerPoint 中为我们的员工制作了一个自定义功能区。功能区上的大多数命令都链接到自定义构建的 VBA 脚本,但我想包含一个标准的 MSO Gallery 命令 (MSO:SlideNewGallery)。

我已成功将按钮添加到功能区。看起来不错,但不起作用。我不知道如何调用标准 MSO 库命令的操作。我尝试编写 VBA 脚本,但库命令在 VBA 中无法正常工作,因此该脚本只是创建了一张新幻灯片并且不显示 SlideNewGallery 选项。

我是自学成才的,我想我可能只是缺少一些非常简单的东西。

我的问题:

  • 我该怎么办?
  • 我应该在 VBA 中还是在 XML 中执行此操作?

这是我的功能区 xml:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="RibbonControl.Onload">
        <ribbon>
            <tabs>
                <tab id="CustomTab1" label="Insurance">
                    <group id="CustGrp1" label="Template" >
                        <button id="Btn1" label="New Presentation" screentip="Create a new presentation" image="Default" size="large" onAction="RibbonControl.MyBtnMacro" />
                    </group>
                    <group id="CustGrp20" label="Insurance Resources" >
                        <gallery id="SlideNewGallery" label="New Slide" screentip="Insert an new slide" imageMso="SlideNewGallery"  size="large" onAction="RibbonControl.MyBtnMacro" />
                        <button id="Btn22" label="Insert Herman" screentip="Insert a Herman Picture" image="HermanIcon"  size="large" onAction="RibbonControl.MyBtnMacro" />
                        <button id="Btn23" label="Insert Logo" screentip="Insert a logo for OMA Insurance or any of our affilliates" image="OMAInsurance"  size="large" onAction="RibbonControl.MyBtnMacro" />
                        <button id="Btn21" label="Content Ideas" screentip="See or copy our favourite insurance presentations" imageMso="BuildingBlockProperties" size="large" 
                        onAction="RibbonControl.MyBtnMacro" />
                        <button id="Btn24" label="Insurance Brand Standards" screentip="Go to the Insurance Brand Standards Document" image="Brand"  size="large" onAction="RibbonControl.MyBtnMacro" />
                    </group>
                    <group id="CustGrp3" label="Tools" >
                        <button id="Btn30" label="Convert to Brand" screentip="Convert this Presentation to BRAND style" image="Convert" size="large" onAction="RibbonControl.MyBtnMacro" />
                        <button id="Btn31" label="Reset Slide" screentip="Apply the fonts and layouts of our Brand" imageMso="QuickStepsGallery" size="large" 
                        onAction="RibbonControl.MyBtnMacro" />
                        <button id="Btn32" label="Insert Asterisk" screentip="Insert an Asterisk" image="AsteriskIcon"  size="large" onAction="RibbonControl.MyBtnMacro" />
                        <button id="Btn33" label="Select Everything" screentip="Select all the text in the active area" imageMso="LassoSelect" size="large" onAction="RibbonControl.MyBtnMacro" />
                    </group>
                </tab>
            </tabs>
        </ribbon>
    </customUI>

【问题讨论】:

  • 应该是&lt;gallery idMso="SlideNewGallery"...吗? (只是预感)另外,如果您有一个附加到onAction 的子程序,请显示该宏的代码。

标签: xml vba ribbon powerpoint


【解决方案1】:

感谢您的帮助,我最终通过将 mso: 放在每个元素前面来完成所有工作。

我不确定为什么会这样……但现在一切都很好。下面是工作代码。

<mso:customUI xmlns:mso="http://schemas.microsoft.com/office/2009/07/customui"><mso:ribbon><mso:tabs><mso:tab id="CustomTab1" label="Insurance">

<mso:group id="CustGrp1" label="Template" ><mso:button id="Btn1" label="New Presentation" screentip="Create a new presentation" image="Default" size="large" onAction="RibbonControl.MyBtnMacro" /><mso:gallery idQ="mso:SlideNewGallery" size="large" showInRibbon="false" visible="true"/>
</mso:group>

<mso:group id="CustGrp2" label="Insurance Resources" >
<mso:button id="Btn22" label="Insert Herman" screentip="Insert a Herman Picture" image="HermanIcon"  size="large" onAction="RibbonControl.MyBtnMacro" />
<mso:button id="Btn23" label="Insert Logo" screentip="Insert a logo for OMA Insurance or any of our affilliates" image="OMAInsurance"  size="large" onAction="RibbonControl.MyBtnMacro" />
<mso:button id="Btn21" label="Content Ideas" screentip="See or copy our favourite insurance presentations" imageMso="BuildingBlockProperties" size="large" onAction="RibbonControl.MyBtnMacro" />
<mso:button id="Btn24" label="Insurance Brand Standards" screentip="Go to the Insurance Brand Standards Document" image="Brand"  size="large" onAction="RibbonControl.MyBtnMacro" />
</mso:group>


<mso:group id="CustGrp3" label="Tools" >
<mso:button id="Btn30" label="Convert to Brand" screentip="Convert this Presentation to BRAND style" image="Convert" size="large" onAction="RibbonControl.MyBtnMacro" />
<mso:button id="Btn31" label="Reset Slide" screentip="Apply the fonts and layouts of our Brand" imageMso="QuickStepsGallery" size="large"  onAction="RibbonControl.MyBtnMacro" />
<mso:button id="Btn32" label="Insert Asterisk" screentip="Insert an Asterisk" image="AsteriskIcon"  size="large" onAction="RibbonControl.MyBtnMacro" />
<mso:button id="Btn33" label="Select Everything" screentip="Select all the text in the active area" imageMso="LassoSelect" size="large" onAction="RibbonControl.MyBtnMacro" />
</mso:group>

</mso:tab></mso:tabs></mso:ribbon></mso:customUI>

【讨论】:

    【解决方案2】:

    使用

              <control idMso="SlideNewGallery"
                   size="large"/>
    

    如果您使用图库,缩略图可能无法正确更新

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-08-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-07-13
      相关资源
      最近更新 更多