XL5: Can't Insert Sheet Based on Template with Hidden Sheet

ID: Q128192


The information in this article applies to:
  • Microsoft Excel for Windows, versions 5.0., 5.0c
  • Microsoft Excel for Windows NT, version 5.0
  • Microsoft Excel for the Macintosh, versions 5.0, 5.0a


SYMPTOMS

In Microsoft Excel, when you insert a new sheet based on a template using the Sheet tab shortcut menu, if the template contains a hidden sheet, one of the following occurs:

    Microsoft Excel for Windows
  • You receive a general protection (GP) fault.


  • Microsoft Excel for the Macintosh
  • You receive the following error message:
    
          Sorry, a system error occurred.
          "Microsoft Excel"
          error type 11 



CAUSE

This behavior occurs if the hidden sheet is the last sheet in the template file, and the sheet was hidden using the xlveryhidden constant in a Visual Basic procedure.

For example, if you create a template file, BOOK1.XLT, that contains the sheets Sheet1 and Sheet2, where Sheet2 is the last sheet in the workbook, and you hide Sheet2 using the following command


   Sheets("Sheet2").Visible = xlveryhidden 
Microsoft Excel stops responding (hangs) when you insert a sheet based on this template in any workbook file.

WORKAROUNDS

To work around this problem, use any of the following methods.

Method 1

When you create a template that you are going to use to insert a new sheet in another workbook, make sure that none of the sheets in the template file are hidden.

Method 2

Open the template that contains the sheets that you want to insert. You can then move or copy individual sheets from the template file to your workbook, or from your workbook to the template file.

NOTE: If you hide any of the sheets in the template file by choosing Sheet from the Format menu, and then choosing Hide, or by setting the Visible property of the sheet to False, Microsoft Excel does not hang when you insert a sheet based on this template; however, none of the sheets in the template are inserted in this case.

For additional information, please see the following article in the Microsoft Knowledge Base:
Q127944 XL5: Sheet Based on Template With Hidden Sheet Not Inserted


MORE INFORMATION

You can set the Visible property of a sheet to xlveryhidden to hide the object so that it can only be made visible again by setting the Visible property to True. That is, the sheet cannot be made visible by choosing Sheet from the Format menu, and then choosing Unhide. Note that this property can be set for a chart, dialog sheet, module or worksheet.


REFERENCES

For more information about Creating An Autotemplate For New Sheets, choose the Search button in Help and type:

templates, creating

For more information about the Visible property, choose the Search button in Visual Basic Help and type:

visible property

Additional query words: 5.00a5.00c gpf crash lock up freeze

Keywords : kbprg
Version : WINDOWS:5.0,5.0c; MACINTOSH:5.0,5.0a
Platform : MACINTOSH WINDOWS
Issue type : kbprb


Last Reviewed: July 29, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.