brucemc
07-31-2007, 02:10 PM
Why will:
Sheets("WhatEver").Visible = xlVeryHidden
work in a module or sheet code page, but not in the ThisWorkBook module within WorkBook_Open() or WorkBook_BeforeClose()? Note: I have at least one sheet visible at all times.
I did a cut & paste of the exact same code from the Sheet1 module to the ThisWorkBook module under both of the above (at different tests) and it always fails in an error '1004': "Unable to set the Visible property of the WorkSheet class."
Is there a way to do so?
btw: I have found reference to both xlVeryHidden and xlSheetVeryHidden. Neither work in the above scenario, both rendering an Error 1004. Anyone know if there are circumstances to use one as opposed to the other?
Sheets("WhatEver").Visible = xlVeryHidden
work in a module or sheet code page, but not in the ThisWorkBook module within WorkBook_Open() or WorkBook_BeforeClose()? Note: I have at least one sheet visible at all times.
I did a cut & paste of the exact same code from the Sheet1 module to the ThisWorkBook module under both of the above (at different tests) and it always fails in an error '1004': "Unable to set the Visible property of the WorkSheet class."
Is there a way to do so?
btw: I have found reference to both xlVeryHidden and xlSheetVeryHidden. Neither work in the above scenario, both rendering an Error 1004. Anyone know if there are circumstances to use one as opposed to the other?