?
Solved

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

Posted on 2008-10-01
11
Medium Priority
?
1,381 Views
Last Modified: 2012-06-27
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
0
Comment
Question by:taduh
  • 5
  • 4
  • 2
11 Comments
 
LVL 85

Expert Comment

by:Rory Archibald
ID: 22619702
Is your active printer the same? Can you manually print to letter size using it?
0
 

Author Comment

by:taduh
ID: 22623280
rorya,

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

taduh
0
 
LVL 85

Expert Comment

by:Rory Archibald
ID: 22625953
And is this in Excel VBA or in VBScript (you have put it in both zones)?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:taduh
ID: 22626985
Its actually in Excel VBA.
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 22628715
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.
0
 

Author Comment

by:taduh
ID: 22633532
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?
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 22666238
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.
0
 

Author Comment

by:taduh
ID: 22668252
Rob,

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

taduh
0
 
LVL 65

Accepted Solution

by:
RobSampson earned 2000 total points
ID: 22673170
Hi, try getting a 32bit driver in a folder on your computer to install the driver from when you get to the "Select a driver" section, and click "Have Disk" and use that location.  Get a 64bit driver and do the same thing for a second test.

I think that should work.

Regards,

Rob.
0
 

Author Closing Comment

by:taduh
ID: 31502165
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.  
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 22782282
That's great.  Thanks for the grade.

Regards,

Rob.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft's Excel has many features that most people will never need nor take advantage of.  Conditional formatting is one feature that you may find a necessity once you start using it.
Windows Explorer lets you open cabinet (cab) files like any other folder. In VBA you can easily handle normal files and folders, but opening and indeed creating cabinet files takes a lot more - and that's you'll find here.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question