Unable to set the PrintQuality using VBA

Kattster

New Member
Joined
May 26, 2011
Messages
20
I am using the following code on my home machine and it works fine but when I use a different printer from work it fails any ideas on another print setting I can use so that it will work regardless of what dpi the printer is capable of.
Home printer 360dpi
Work printer 600 dpi

With ActiveSheet.PageSetup<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:eek:ffice:eek:ffice" /><o:p></o:p>
.LeftHeader = ""<o:p></o:p>
.CenterHeader = ""<o:p></o:p>
.RightHeader = ""<o:p></o:p>
.LeftFooter = ""<o:p></o:p>
.CenterFooter = ""<o:p></o:p>
.RightFooter = ""<o:p></o:p>
.LeftMargin = Application.InchesToPoints(0.71)<o:p></o:p>
.RightMargin = Application.InchesToPoints(0.71)<o:p></o:p>
.TopMargin = Application.InchesToPoints(0.75)<o:p></o:p>
.BottomMargin = Application.InchesToPoints(0.75)<o:p></o:p>
.HeaderMargin = Application.InchesToPoints(0.31)<o:p></o:p>
.FooterMargin = Application.InchesToPoints(0.31)<o:p></o:p>
.PrintHeadings = False<o:p></o:p>
.PrintGridlines = False<o:p></o:p>
.PrintComments = xlPrintNoComments<o:p></o:p>
.PrintQuality = -2<o:p></o:p>
.CenterHorizontally = False<o:p></o:p>
.CenterVertically = False<o:p></o:p>
.Orientation = xlLandscape<o:p></o:p>
.Draft = False<o:p></o:p>
.PaperSize = xlPaperA4<o:p></o:p>
.FirstPageNumber = xlAutomatic<o:p></o:p>
.Order = xlDownThenOver<o:p></o:p>
.BlackAndWhite = False<o:p></o:p>
.Zoom = False<o:p></o:p>
.FitToPagesWide = 1<o:p></o:p>
.FitToPagesTall = 1<o:p></o:p>
End With<o:p></o:p>
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Not sure what you mean by 'fails'.
Can try
Code:
.PrintQuality = Array(600,600)
or
Code:
.PrintQuality = 600
 
Upvote 0
If I use
.PrintQuality = 600

on my home machine using a Mac and different printer

I Get "Run-time error'1004'

"Unable to set the PrintQuality property of the PageSetup class"

However if i use
.PrintQuality = 360

on my home machine it works but then I get an error on the work printer which
seems to only recognise

.PrintQuality = 600

Hope this makes sense

Katt
 
Upvote 0
Yeah, I have the same problem here. No solution yet.


If I use
.PrintQuality = 600

on my home machine using a Mac and different printer

I Get "Run-time error'1004'

"Unable to set the PrintQuality property of the PageSetup class"

However if i use
.PrintQuality = 360

on my home machine it works but then I get an error on the work printer which
seems to only recognise

.PrintQuality = 600

Hope this makes sense

Katt
 
Upvote 0
I'm pretty Mac-ignorant and there is gross-little in search results; but maybe:

Code:
If Left(Application.OperatingSystem, 3) = "Win" Then
    PrintSetup.PrintQuality = 600
Else
    PrintSetup.PrintQuality = 360
End If
[untested]
 
Upvote 0
i got it to work when i commented out the ".PrintQuality = 600" line.

microsoft has a completely unhelpful "support" page:You cannot use page setup properties in Excel if no printers were installed which says you must have at least one printer driver set up on your computer. I have several printer drivers on my computer. I get the same error Katt gets.

I had same problem using same computer. Worked fine at home when printer available, failed when traveling and printer was not available. Commented out the .PrintQuality line and macro worked fine.
 
Upvote 0

Forum statistics

Threads
1,215,069
Messages
6,122,959
Members
449,096
Latest member
Anshu121

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top