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
1,130 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
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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 500 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VMWare Calculate number of processors 10 64
Collapse and expand table in Word 2010 2 32
Excel Macro 9 18
Index Match Formula VBA 6 17
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
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…

856 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