XL: Cannot Use Page Setup in Macro If No Printers Installed

Last reviewed: March 9, 1998
Article ID: Q172320
The information in this article applies to:
  • Microsoft Excel 97 for Windows
  • Microsoft Excel for Windows 95, versions 7.0, 7.0a
  • Microsoft Excel for Windows NT, version 5.0
  • Microsoft Excel for Windows, versions 5.0, 5.0c

SYMPTOMS

In the versions of Microsoft Excel listed above, if you run a Visual Basic for Applications macro that attempts to set or get the page setup properties for any sheet in a workbook, you may receive either of the following error messages

   Run-time error '1004':
   Unable to set the <x> property of the PageSetup class

   -or-

   Run-time error '1004':
   Unable to get the <x> property of the PageSetup class

where <x> is any of the following words:

   BlackAndWhite        Order
   BottomMargin         Orientation
   CenterFooter         PaperSize
   CenterHeader         PrintArea
   CenterHorizontally   PrintComments
   CenterVertically     PrintGridlines
   ChartSize            PrintHeadings
   Draft                PrintNotes
   FirstPageNumber      PrintTitleColumns
   FitToPagesTall       PrintTitleRows
   FitToPagesWide       RightFooter
   FooterMargin         RightHeader
   HeaderMargin         RightMargin
   LeftFooter           TopMargin
   LeftHeader           Zoom
   LeftMargin

CAUSE

This problem occurs when there are no printer drivers installed on your computer. Microsoft Excel cannot set or get page setup properties if no printer drivers are installed.

RESOLUTION

To prevent this problem from occurring, install a printer driver on your computer. Use the appropriate method for your situation:

  • In Microsoft Windows 95, Microsoft Windows 3.x, and Microsoft Windows NT version 4.0, use the Printers option in Control Panel to add and remove printer drivers.
  • In Microsoft Windows NT version 3.x, use the Print Manager to add and remove printer drivers.

STATUS

This behavior is by design of the versions of Excel listed above.

MORE INFORMATION

In Microsoft Excel, page setup properties are only useful when you print or print preview one or more sheets in a workbook. Because of this, you cannot change or return most page setup properties unless at least one printer driver is installed as the default printer.

If you click Page Setup on the File menu when no printer drivers are installed, you receive the following error message:

   There are no printers installed. Use the Printers option in Control
   Panel to install a printer.

Just as you cannot access the Page Setup dialog box in this case, you cannot access the properties in the dialog box programmatically.


Additional query words: XL97 XL7 XL5 3.1 3.11 3.5 3.51 5.00c 7.00a
Keywords : kbprg kbdta xlvbahowto xlvbainfo xlprint
Version : WINDOWS:5.0,5.0c,7.0,7.0a,97; WINDOWS NT:5.0
Platform : NT WINDOWS
Issue type : kbprb


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: March 9, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.