I have the following sub in ThisWorkbook:
Private Sub workbook_open()
msgbox ActiveSheet.Name
End Sub
When the workbook opens, the msgbox
line gives this error:
Run-time error '32089':
Application-defined or object-defined error
Trying to call the sheet from the Immediate window with:
?Sheets("problemSheetName").Name
also gives the same error. However, other sheets:
?Sheets("someOtherSheet").Name
do not produce this error.
I can't delete this worksheet, because Excel crashes whenever I try to delete it. There is also an ActiveX button on this sheet that crashes Excel when I try to delete it. The button is linked to some code, but it does not run this code when the button is clicked--a breakpoint shows that the code is never executed. Deleting data from cells on the worksheet does not crash Excel.
Is the worksheet just corrupt? I'd prefer not to have to copy the data into another workbook, because this book has 20 sheets, 50 class modules, and several hundred workbook-level named ranges.
EDIT: compiling the VBA gives this error:
Object library invalid or contains references to object definitions
that could not be found