Tag: onload event

Excel VBA .xlam中的onLoadfunction区callback失败(未触发/正在运行)

我已经创build了一个简单的Excel加载项来演示问题,即在保存项目时,function区onLoad事件不会触发,并以.xlam自动加载,但在以.xlsm打开时可以正常工作。 我已经检查了它的Excel 2007(与相应的xmlns),2010(x32)和2013(x32),并且在所有情况下加载为.xlam 该示例有一个单一的button,单击时,应导致一个标志被切换,然后无效的function区依次通过GetLabelcallback切换button的标签。 它作为.xlsm文件打开时工作,但不会从用户XLSTART文件夹(不进行Windowsregistry更改)自动加载为.xlam加载项。 问题似乎是onLoad事件不会从.xlam版本触发,因此onLoadRibbon procudure不会运行,也没有Ribbon对象失效。 <customUI onLoad="onLoadRibbon" xmlns="http://schemas.microsoft.com/office/2009/07/customui"> <ribbon startFromScratch="false"> <tabs> <tab idQ="TabInsert"> <group id="GroupTest" label="2010" insertBeforeMso="GroupInsertLinks"> <button id="ButtonTest" getLabel="GetLabel" onAction="ButtonClick"/> </group> </tab> </tabs> </ribbon> </customUI> 这里是相应的插件VBA代码: Option Explicit Public Toggle As String Public myRibbonUI As IRibbonUI ' Ribbon callback : runs when ribbon is loaded Public Sub onLoadRibbon(ribbon As IRibbonUI) ' Get […]