Microsoft KB Archive/89405

= Microsoft Knowledge Base =

MXL: Unable to Set Paper Size with a Macro
Last reviewed: July 16, 1997

Article ID: Q89405

The information in this article applies to:


 * Microsoft Excel for the Macintosh, versions 3.0, 4.0, 5.0, 5.0a

SYMPTOMS
In Microsoft Excel for the Macintosh, if you use the PaperSize property in a Visual Basic macro or if you specify a value for the PAPER_SIZE argument for the Microsoft Excel 4.0 PAGE.SETUP macro function, you may not receive the results you expect. In Microsoft Excel versions 5.0 and later, you receive the following error message:

Unable to set the PaperSize property of the PageSetup class In earlier versions of Microsoft Excel, the argument is ignored.

CAUSE
Macintosh system software does not support a standard method for selecting paper sizes that may vary from printer to printer.

WORKAROUND
To work around this problem, follow the appropriate procedure below.

Method 1: If you are creating a Visual Basic macro, use the following line

of code to display the Page Setup dialog box, and allow the user to specify a page size manually:

Application.Dialogs(xlDialogPageSetup).Show

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. Method 2: If you are creating a Microsoft Excel version 4.0 macro,

substitute a PAGE.SETUP? statement to allow manual selection of         paper size, or use predefined templates for creating reports that have already been set to an appropriate paper size.

STATUS
Selecting paper size under macro control is not supported on the Macintosh platform.

MORE INFORMATION
Microsoft Excel Help states that the PaperSize property applies to Windows programs only.

On page 174 of the &quot;Microsoft Excel Function Reference&quot; for the Macintosh, version 3.0, the description for the PAGE.SETUP function states macro control of orientation, paper size, and scaling is only available in Microsoft Excel for Windows.