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

Last reviewed: February 2, 1998
Article 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 that 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:

   ARTICLE-ID: Q127944
   TITLE     : 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.00 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
Solution Type : kbworkaround


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 2, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.