(DISCLAIMER: I'm not a programmer, I spend my time on serverfault, I'm just a lowly admin)
(免责声明:我不是程序员,我把时间花在服务器故障上,我只是一个卑微的管理员)
We have an excel spreadsheet with vb code in it that was created in Office 2003.
我们有一个excel电子表格,其中包含在Office 2003中创建的vb代码。
We've recently gone to Office 2007, and the spreadsheet continued to work as normal.
我们最近去了Office 2007,电子表格继续正常工作。
However, after installing service pack 2 for Office 2007 the spreadsheet now fails with an error stating : "variable not defined"
但是,在为Office 2007安装Service Pack 2之后,电子表格现在失败,并显示错误消息:“变量未定义”
If I comment out the "Option Explicit" statement at the top of the code then the code works fine.
如果我在代码顶部注释掉“Option Explicit”语句,那么代码工作正常。
What I don't understand is that when the error occurs it is occurring on something that isn't even a variable (unless I'm wrong?).
我不明白的是,当错误发生时,它发生在甚至不是变量的东西上(除非我错了?)。
Click the below image to see the screenshot:
点击下面的图片查看截图:
http://filedb.experts-exchange.com/incoming/2009/06_w23/t144890/snip.JPG
3 个解决方案
#1
The reference to the package/addin/whatever that DataGrid exists in probably needs to be re-referenced. Check Tools -> References in the Menu.
可能需要重新引用对DataGrid存在的包/ addin /的引用。在菜单中选中工具 - >参考。
EDIT: OK, here's what I found, it appears that if you install Microsoft Security Advisory 960715, that that control is killed. There are fixes which may or may not work for you. A good article is on this blog:
编辑:好的,这是我发现的,似乎如果您安装Microsoft安全通报960715,该控件将被终止。有一些修复可能适用于您,也可能不适合您。这篇博客上有一篇好文章:
#2
The variable is an object that exists in the excel spreadsheet itself, hence the events you see above state DataGrid1_Click
which is an event handler. This is why you can't see the variable definition. Perhaps DataGrids aren't supported in post-SP2 installs?
变量是excel电子表格本身中存在的对象,因此您在上面看到的事件表明DataGrid1_Click是一个事件处理程序。这就是您无法看到变量定义的原因。 SP2之后的安装可能不支持DataGrids吗?
#3
- Verify that the object is still named "datagrid1".
- Try prefixing the object with "Me" (Me.DataGrid1)
- Could be an early symptom of corruption. Try cutting (ctrl-x) the entire code. Then from the debug menu click compile. Paste the code back in an compile again. Sometimes this simple measure will fix it. (If not an you still suspect corruption there are more advanced measure to be taken.)
验证该对象仍被命名为“datagrid1”。
尝试使用“Me”(Me.DataGrid1)为对象添加前缀
可能是腐败的早期症状。尝试剪切(ctrl-x)整个代码。然后从调试菜单中单击编译。再次将代码粘贴回编译中。有时这个简单的措施会解决它。 (如果不是你仍然怀疑腐败,那么还有更高级的措施。)
#1
The reference to the package/addin/whatever that DataGrid exists in probably needs to be re-referenced. Check Tools -> References in the Menu.
可能需要重新引用对DataGrid存在的包/ addin /的引用。在菜单中选中工具 - >参考。
EDIT: OK, here's what I found, it appears that if you install Microsoft Security Advisory 960715, that that control is killed. There are fixes which may or may not work for you. A good article is on this blog:
编辑:好的,这是我发现的,似乎如果您安装Microsoft安全通报960715,该控件将被终止。有一些修复可能适用于您,也可能不适合您。这篇博客上有一篇好文章:
#2
The variable is an object that exists in the excel spreadsheet itself, hence the events you see above state DataGrid1_Click
which is an event handler. This is why you can't see the variable definition. Perhaps DataGrids aren't supported in post-SP2 installs?
变量是excel电子表格本身中存在的对象,因此您在上面看到的事件表明DataGrid1_Click是一个事件处理程序。这就是您无法看到变量定义的原因。 SP2之后的安装可能不支持DataGrids吗?
#3
- Verify that the object is still named "datagrid1".
- Try prefixing the object with "Me" (Me.DataGrid1)
- Could be an early symptom of corruption. Try cutting (ctrl-x) the entire code. Then from the debug menu click compile. Paste the code back in an compile again. Sometimes this simple measure will fix it. (If not an you still suspect corruption there are more advanced measure to be taken.)
验证该对象仍被命名为“datagrid1”。
尝试使用“Me”(Me.DataGrid1)为对象添加前缀
可能是腐败的早期症状。尝试剪切(ctrl-x)整个代码。然后从调试菜单中单击编译。再次将代码粘贴回编译中。有时这个简单的措施会解决它。 (如果不是你仍然怀疑腐败,那么还有更高级的措施。)