2

(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.

We've recently gone to Office 2007, and the spreadsheet continued to work as normal.

However, after installing service pack 2 for Office 2007 the spreadsheet now fails with an error stating : "variable not defined"

If I comment out the "Option Explicit" statement at the top of the code then the code works fine.

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

0

3 Answers 3

4

The reference to the package/addin/whatever that DataGrid exists in probably needs to be re-referenced. Check Tools -> References in the Menu.

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:

VSOD Blog

Sign up to request clarification or add additional context in comments.

1 Comment

I attempted this by unchecking the "Microsoft DataGrid Control 6.0" (MSDATGRD.OCX file) in the References. Saving the .xlsm, Then adding it back in. Still get the same error.
0

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?

Comments

0
  1. Verify that the object is still named "datagrid1".
  2. Try prefixing the object with "Me" (Me.DataGrid1)
  3. 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.)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.