Sdílet prostřednictvím


Hidden Worksheets

Microsoft Office Excel worksheets that are formatted as hidden are not visible in the Visual Studio designer, but they are visible in Solution Explorer. Double-clicking the sheet in Solution Explorer opens the code file for the sheet, instead of opening the visual designer.

Applies to: The information in this topic applies to document-level projects for Excel 2007 and Excel 2010. For more information, see Features Available by Office Application and Project Type.

Hiding a Worksheet Programmatically

You can hide worksheets programmatically so that they are visible in the visual designer, but are not visible when the solution runs, by using the worksheet property xlSheetHidden or xlSheetVeryHidden. For example, you can put the following code in the code file behind the sheet you want to hide.

Me.Visible = Excel.XlSheetVisibility.xlSheetVeryHidden
this.Visible = Excel.XlSheetVisibility.xlSheetVeryHidden;

The property xlSheetHidden hides the sheet, but it can be made visible by any user through the Excel user interface. If you use xlSheetVeryHidden, however, the user cannot make the sheet visible through the Excel user interface.

See Also

Concepts

Office Projects in the Visual Studio Environment

Hidden Worksheets

Office Projects in the Visual Studio Environment