Windows DPI Settings Affecting P_rint

FRIJOE

New Member
Joined
May 4, 2017
Messages
19
Hello,

I am trying to create a series of forms to be used throughout my company but have noticed they print different on other user's computer's than my own. I used VBA to manually set the print margins and print area, but the problem persisted. After much frustration, I came to realize that the particular user's windows DPI settings (Start >> Control Panel >> Display >> "Set Custom Text Size (DPI)" was different. Mine is set to "smaller - 100%" (96 pixels per inch) while others were set to 125% (120 pixels per inch), 150% (144 pixels per inch), and even 200% (192 pixels per inch).

Ideally, I would like all users to be able to print the form and have it come out the same. As of now, there is noticeable deformation of the title block by at least one inch while printing 11x17.

My question:
Is there a way for Excel VBA to override windows DPI settings?
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).

HackSlash

Active Member
Joined
Nov 18, 2016
Messages
360
No. The nature of DPI is to change everything. That's the feature.

Tell the old men to put glasses on and get IT to force normal scaling on all PCs.
 

mole999

Moderator
Joined
Oct 23, 2004
Messages
10,524
Office Version
  1. 2019
  2. 2016
  3. 2013
Platform
  1. Windows
what does your print routine look like
 

FRIJOE

New Member
Joined
May 4, 2017
Messages
19
mole999; print routine as in my code so far? please see below

Code:
Sub toPDF()
    thepath = CStr(Range("AQ13").Value)
    thename = CStr(Range("AQ16").Value)
    newrando = Int((50 - 1 + 1) * Rnd + 1)
    On Error GoTo Handled
    
    If Len(Dir(thepath & "\printouts", vbDirectory)) = 0 Then
        MkDir thepath & "\printouts"
    End If

    With ActiveSheet.PageSetup
        .PaperSize = xlPaperTabloid
        .PrintArea = "$A$1:$AO$67"
        .LeftMargin = _
            Application.InchesToPoints(0.25)
        .RightMargin = _
            Application.InchesToPoints(0#)
        .HeaderMargin = _
            Application.InchesToPoints(0.25)
        .FooterMargin = _
            Application.InchesToPoints(0.2)
        .TopMargin = _
            Application.InchesToPoints(0.25)
        .BottomMargin = _
            Application.InchesToPoints(0#)
        .PrintQuality = 96
        .Zoom = False
        .FitToPagesWide = 1
        .FitToPagesTall = 1
    End With
    
    If ActiveSheet.PageSetup.Orientation = xlPortrait Then
        ActiveSheet.PageSetup.Orientation = xlLandscape
        Else
        ActiveSheet.PageSetup.Orientation = xlLandscape
    End If
        
    
    FileNam = thepath & "\printouts" & thename & ".pdf"
    ActiveSheet.ExportAsFixedFormat Filename:=FileNam, Type:=xlTypePDF, OpenAfterPublish:=True
    
    Exit Sub
Handled:
    FileNam = thepath & "\printouts" & thename & newrando & ".pdf"
    ActiveSheet.ExportAsFixedFormat Filename:=FileNam, Type:=xlTypePDF, OpenAfterPublish:=True


End Sub
 
Last edited by a moderator:

mole999

Moderator
Joined
Oct 23, 2004
Messages
10,524
Office Version
  1. 2019
  2. 2016
  3. 2013
Platform
  1. Windows

ADVERTISEMENT

I'm guessing
.PrintQuality = 96

.FitToPagesWide = 1
.FitToPagesTall = 1

print quality 96 changes anything you have coded above, and then you are changing it again by setting the width and height, it maybe doing exactly what you are asking it todo
 

FRIJOE

New Member
Joined
May 4, 2017
Messages
19
Mole999, I am still experiencing the noticeable print deformation with or without the printquality or fittopages mentioned above.

As much as I would like to use HackSlashe's advice posted above, unfortunately I'm unable to heal the old men's eye sight and decrease their DPI settings company wide.
 

mole999

Moderator
Joined
Oct 23, 2004
Messages
10,524
Office Version
  1. 2019
  2. 2016
  3. 2013
Platform
  1. Windows
well they are using tabloid size (is that A2), not sure.

Potential to force the system to print to PDF, and when they want to print out they get that to scale to there final size which should keep it all relative
 

Forum statistics

Threads
1,136,969
Messages
5,678,883
Members
419,787
Latest member
juanam

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
Top