ID: Q121268
5.00 WINDOWS kbprg
The information in this article applies to:
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.
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
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.
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.
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
Version : 5.00
Platform : WINDOWS
Last Reviewed: September 14, 1996