Link to home
Start Free TrialLog in
Avatar of taduh
taduhFlag for United States of America

asked on

Why have I just started getting the error "Unable to set the PaperSize property of the PageSetup class?

Recently on some of my time tested VBA Excel macros, I have started getting the message "Unable to set the PaperSize property of the PageSetup class" This error message targets the statement:

.Papersize = xlPaperLetter

Here is the code within which the staement is failing:

With ActiveSheet.PageSetup
        .PrintTitleRows = ""
        .PrintTitleColumns = "$A:$A"
        .LeftMargin = application.InchesToPoints(0.1)
        .RightMargin = application.InchesToPoints(0.1)
        .TopMargin = application.InchesToPoints(0.44)
        .BottomMargin = application.InchesToPoints(0.25)
        .HeaderMargin = application.InchesToPoints(0)
        .FooterMargin = application.InchesToPoints(0)
        .PrintQuality = 600
        .CenterHorizontally = True
        .CenterVertically = False
        .Orientation = xlLandscape
        .PaperSize = xlPaperLetter
        .Order = xlDownThenOver
        .Zoom = 100
    End With
   
I am unaware of any wholesale changes made to the printers lately and no changes have been made to my computer. That's why I find this such a mystery. Any ideas?

Thanks,

Taduh
Avatar of Rory Archibald
Rory Archibald
Flag of United Kingdom of Great Britain and Northern Ireland image

Is your active printer the same? Can you manually print to letter size using it?
Avatar of taduh

ASKER

rorya,

Yes, my active printer is the same and I can manually print to letter size using it.

taduh
And is this in Excel VBA or in VBScript (you have put it in both zones)?
Avatar of taduh

ASKER

Its actually in Excel VBA.
What happens if you delete your connection to the printer, recreate it, and set it as the default?  Or if you select a different default printer to test with?  Maybe your printer connection is corrupt....

Regards,

Rob.
Avatar of taduh

ASKER

Rob,

I tried your suggestion and it did not help. I did find out that they have been migrating our printers from 32 bit to 64 bit over the last several months. Could this have anything to do with it? If so, do you know of anything I can do still be able to specify paper size via my VBA macro?
It probably is due to new drivers......

What happens if you connect to that printers IP address, by going to:
Control Panel --> Printers and Faxes --> Add Printer --> Local Printer (do not automatically detect my printer) --> Create a new port --> Standard TCP/IP port --> Enter the printer's IP Address --> Select a driver (maybe try 32 and 64 bit drivers separately)

Then if you try to print to that, what happens with the different driver versions?

Regards,

Rob.
Avatar of taduh

ASKER

Rob,

How do I tell whther a driver is 32-bit or 64-bit?

taduh
ASKER CERTIFIED SOLUTION
Avatar of RobSampson
RobSampson
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of taduh

ASKER

Rob,
Youu were on the right track. It had to do with the drivers. I had IT set me up a "printer" using the 32-bit driver and now I reference that printer in my code. Thanks and sorry for the delay.  
That's great.  Thanks for the grade.

Regards,

Rob.