XL5: Problems Running or Recording Macro to Set Print Title

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

SYMPTOMS

In Microsoft Excel version 5.0, if you use the Set Print Titles command (with Microsoft Excel 4.0 menus displayed) to set a print title while the macro recorder is running, one of the following occurs:

  • You receive a syntax error when you run the recorded macro

    -or-

  • An hourglass pointer appears and Microsoft Excel stops responding when you choose OK in the Print Titles dialog box

    -or-

  • You receive a general protection (GP) fault

CAUSE

If you choose Set Print Titles from the Options menu with the Microsoft Excel 4.0 menus displayed, while the macro recorder is running, a command similar to the following is recorded:

   ExecuteExcel4Macro "SET.PRINT.TITLES(Rows("1:1"),Columns("C:C"))"

You receive a syntax error when you run this procedure.

If you select a row or column on the worksheet before you choose Set Print Titles, and you only enter data in the Title For Columns box, an hourglass pointer appears and Microsoft Excel stops responding when you choose OK in the Set Print Titles dialog box.

If you only enter data in the Title For Rows box, you receive a GP fault when you choose OK in the Set Print Titles dialog box.

Note that these behaviors do not occur when you record the macro using the Microsoft Excel 4.0 Macro language.

WORKAROUNDS

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.

To avoid the behaviors described above, use the following Visual Basic procedure to set print titles on the active worksheet:

   Sub Set_Print()
      With ActiveSheet.PageSetup
        ' Replace $1:$1 with the desired range
        .PrintTitleRows = "$1:$1"
        ' Replace $A:$A with the desired range
        .PrintTitleColumns = "$A:$A"
      End With
   End Sub

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 a later version of Microsoft Excel.

REFERENCES

For more information about Printing Titles On Multiple Pages, choose the Search button in Help and type:

    titles


KBCategory: kbprg
KBSubcategory:

Additional reference words: 5.00 err msg gpf hang



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.