Error 1004 - "Unable to set the PaperSize property of the PageSetup class" in Access 2003


  • Good Day,

    I am experiencing a '1004' error "Unable to set the PaperSize property of the PageSetup class" when I attempt to set this property to "xlPaperLegal" on an Excel spreadsheet in Access 2003.  I am using the following code to set this property;
        xlwks.PageSetup.PaperSize = xlPaperLegal
    The code used to define the xlks follows
        Dim xlwks As Object
        Set xlwkb = xlapp.Workbooks.Add
    Can any suggest any changes to correct this error?


    David Y
    Tuesday, June 19, 2007 1:55 PM

All replies

  • David,


    Two things for you...


    1. Verify the active printer supports the Legal paper size


    2.  Since you are calling this from MS Access you may need to prefix the xlPaperLegal value with either

    • xlPaperSize.xlPaperLegal

    • xlapp.xlPaperSize.xlPaperLegal


    Tuesday, June 19, 2007 5:15 PM
  • You need to install a printer ! the most likely cause of this error is if you are testing on a clean VM or test box that doesn't have any default printer, or perhaps a less likely cause would be if the printer you have set as the default printer doesn't support this type of paper size value.
    Microsoft Robotics Studio Fanatic
    Tuesday, April 20, 2010 1:55 AM