?
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,248 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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

Technology Partners: 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

This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This article describes a serious pitfall that can happen when deleting shapes using VBA.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

764 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