XL5: GP Fault Setting PageSetup Object Property to Null

Last reviewed: September 12, 1996
Article ID: Q121268
The information in this article applies to:
  • Microsoft Excel for Windows, version 5.0

SYMPTOMS

In Microsoft Excel, if you set the value of one of the PageSetup object header or footer properties, such as the RightFooter property, to Null in a Visual Basic procedure, you receive a general protection (GP) fault.

CAUSE

This problem occurs because the PageSetup object property is expected to be set to a string value, and cannot be set to the Null value. The Null value is a value indicating that a variable contains no valid data.

This problem occurs when you set any of the following properties of the PageSetup object to Null:

   RightHeader
   CenterHeader
   LeftHeader
   RightFooter
   CenterFooter
   LeftFooter

WORKAROUND

To avoid receiving a GP fault when you set the value of the PageSetup property, do not use the Null value. Instead, to clear the information in the header or footer on the worksheet, set the header or footer property of the PageSetup object to the value "". For example, to clear the information in the right footer on the current worksheet, use the following code:

   ActiveSheet.PageSetup.RightFooter = ""

Microsoft provides examples of Visual Basic procedures for illustration only, without warranty either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. This Visual Basic procedure is provided 'as is' and Microsoft does not guarantee that it can be used in all situations. Microsoft does not support modifications of this procedure to suit customer requirements for a particular purpose.

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. This problem was corrected in Microsoft Excel version 5.0c.

REFERENCES

For more information about Null <definition>, choose the Search button in the Visual Basic Reference and type:

    Null


KBCategory: kbprg
KBSubcategory:

Additional reference words: 5.00 gpf



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: September 12, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.