VBA - Word 2007 - 下标超出范围(错误 9)
我不知道是什么原因造成的。 我创建了一个模板,其中包含大量宏代码。我使用 Office 2007 应用程序的自定义 UI 编辑器在功能区界面中创建自定义选项卡。在此选项卡中,我有一个应该打开用户表单的按钮。该按钮的 XML 代码如下:
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon startFromScratch="false">
<tabs>
<tab id="CustomForm" label="CustomForm">
<group id="customuserdata" label="Custom Userdata">
<button id="openForm" label="Open userform" imageMso="OpenForm" size="large" onAction="openForm" />
</group>
</tab>
</tabs>
</ribbon>
</customUI>
在同一个模板中,我有一个名为 openForm
的公共子,我只需运行 myForm.Show
。正是在这个子中,发生了错误“运行时错误'9'。子脚本超出范围”。什么可能导致这种情况?
我试图调用的 Sub 的确切代码是这样的:
Public Sub openForm(control As IRibbonControl)
FormAltData.Show ' This is where the debugger stops at'
End Sub
I don't know what's causing this.
I've created a template with a lot of macro code in it. And I've used the Custom UI EDitor for Office 2007 applications to create a custom Tab in the Ribbon interface. In this tab I've got this button which is supposed to open a userform. The XML code for the button is this:
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon startFromScratch="false">
<tabs>
<tab id="CustomForm" label="CustomForm">
<group id="customuserdata" label="Custom Userdata">
<button id="openForm" label="Open userform" imageMso="OpenForm" size="large" onAction="openForm" />
</group>
</tab>
</tabs>
</ribbon>
</customUI>
And in the same Template I've got a Public Sub named openForm
and it this I just run myForm.Show
. It's in this sub that the error occurs "Run-Time error '9'. SubScript out of range". What could cause this?
The exact code of the Sub I'm trying to call is this:
Public Sub openForm(control As IRibbonControl)
FormAltData.Show ' This is where the debugger stops at'
End Sub
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我相信该错误是由数组引起的。我试图在声明数组之前访问它 ^^ 我的错:)
The error was caused by an Array I believe. I tried to access an array before it was even declared ^^ My bad :)