Excel Ribbon Not Switching To Tab When Opening

情到浓时终转凉″ 提交于 2021-01-29 10:11:52

问题


I have an Excel 2013 workbook and am trying to switch a custom tab when the it is opened.

I have the following CustomUIx.xml entries:

CustomUI.xml

<customUI onLoad="RibbonOnLoad" xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon>
    <tabs>
        <tab id="CustomHFG" label="Custom" insertAfterMso="TabDeveloper">

        </tab>
    </tabs>
</ribbon>

CustomUI14.xml

<customUI onLoad="RibbonOnLoad" xmlns="http://schemas.microsoft.com/office/2009/07/customui">
<ribbon>
    <tabs>
        <tab id="CustomHFG" label="Custom" insertAfterMso="TabDeveloper">

        </tab>
    </tabs>
</ribbon>

and the folloing VBA code in a module:

Option Explicit
Public ribRibbon As IRibbonUI

Public Sub RibbonOnLoad(ribbon As IRibbonUI)
    Set ribRibbon = ribbon
    ribRibbon.ActivateTab ("CustomHFG")
End Sub

When I open the workbook, it does not activate the 'CustomHFG' tab. I believe the RibbonOnLoad sub is being called as I have a debug.asset false statement after the ribRibbon.ActivateTab ("CustomHFG") line and it breaks here so I'm sure ActivateTab is being called.

Any suggestions as to why this is not activating the tab on open?

Thanks

来源:https://stackoverflow.com/questions/56780279/excel-ribbon-not-switching-to-tab-when-opening

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!