## XL5: Problems Running or Recording Macro to Set Print Title

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

Additional query words: err msg gpf hang

Keywords :
Version : 5.00
Platform : WINDOWS
Issue type :
Technology :

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