Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Today I started to get errors from an Excel workbook containing macros; until now it has ben working nicely. I could narrow down the problem to a line containing ActiveSheet.CodeName.

Even when I run a very simple macro like

Sub tst()
MsgBox ActiveSheet.Codename
End Sub

or just type in the Immediate window

debug.print ActiveSheet.Codename

this works on some activated worksheets, while after activating other sheets of the same workbook (of course a single sheet each time) I get:

Run-time error '32809', Application-defined or object-defined error.

This is the case with different variations like activeworksheet.name, .index, etc. However, Activeworkbook.xxx works well.

I work with Excel 2010, VBA 7.0, Windows 7.

share|improve this question
    
Googling "excel vba Run-time error '32809', Application-defined or object-defined error." brings up a number of confusing questions and answers. The only thing they have in common is to blame ActiveX controls. Could this be the cause for you? –  Tony Dallimore Apr 22 '12 at 9:42
    
Thanks for this sugetsion! In fact the problem occurred in sheets with a combobox. However, removing carefully ALL VBA code accessing that combobox, the combobox itself, and few non-activeX elements (Find&Select, selection pane -> no object in whole workbook) does not solve the problem. It only changed the error message; even with "Break on all Errors" (to avoid them being overlooked in error handlers) there is no VBA error message, only the very informative "Excel has stopped working, try to recover work...". ??? –  Martin Apr 22 '12 at 12:39
    
Meanwhile I deleted data validation by lists. Only when selecting the whole column to clear data validation, this solved the problem! However, selecting all data validation containing cells by Find&Select 'data validation' to clear data validation (and there where none detectable left) , this did NOT change anything. Reproduced that several times. Strange - any idea why? –  Martin Apr 22 '12 at 23:15

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.