Microsoft KB Archive/80366

{| = Excel: PAGE.SETUP Halts Macro with Show Info Window Active =
 * width="100%"|

Last reviewed: November 16, 1994

Article ID: Q80366 The information in this article applies to:
 * Microsoft Excel for Windows, version 3.0

SUMMARY
If a Show Info window is active in Microsoft Excel, running a macro with the PAGE.SETUP function may result in a macro error if the function includes parameters for row and column headings and gridlines. (To access the Show Info window, choose Show Info from the Window menu.)

MORE INFORMATION
With a Show Info window active, the File Page Setup command allows you to change the values in the Header and Footer text boxes and the Left, Right, Top, and Bottom Margins text boxes. Depending on the printer driver you're using, you may also be able to change the Orientation, Paper, and Scaling options. The Row & Column Headings and Gridlines check boxes are not present, and the Center Horizontally and Center Vertically check boxes are unavailable (dimmed).

While there is no documented PAGE.SETUP function specifically for a Show Info window, including all of the 13 possible parameters will cause the macro to halt. The macro recorder will record the function with only 11 parameters, omitting the headings and gridlines because the appropriate options do not appear in the Page Setup dialog box. FALSE,FALSE will be recorded for H_Center and V_Center.

Workaround
Remove the parameters in the PAGE.SETUP function for headings and gridlines.

Steps to Reproduce Problem
  Enter the following into cell A2 of a new macro sheet: =PAGE.SETUP(&quot;&F&quot;,&quot;&P&quot;,0.75,0.75,1,1,FALSE,TRUE,FALSE,FALSE,1,1,100)   In cell A3, type: =RETURN   In cell A1, type: test  Make cell A1 the active cell and choose Define Name from the Formula menu. Select Command in the Macro section and choose OK. From the Window menu, choose Show Info. From the Macro menu, choose Run. Select Test and choose OK. The macro will halt at cell A2.  Remove the first two boolean parameters (headings and gridlines) so that the function appears as follows: =PAGE.SETUP(&quot;&F&quot;,&quot;&P&quot;,0.75,0.75,1,1,FALSE,FALSE,1,1,100) 

The macro will now run successfully without error.