none
Excel Page settings do not behave the same between environments RRS feed

  • General discussion

  • Hello dear Community

    One of my latest problems is, that sheets which are set up with the exact same properties do not get printed the same way.

    The two systems I am testing right now is a Windows 7 environment and a Windows 10 environment, both with Excel 16.0.4954.1000 and MSO 16.0.4939.1000 32-bit.

    The page settings I apply are as followed:

    For Each ws In wb
        If ws.Name Like "Print*" Then
            ws.PageSetup.Orientation = xlPortrait
            ws.PageSetup.PaperSize = xlPaperA4
            ws.PageSetup.LeftMargin = 5.66929133858268
            ws.PageSetup.RightMargin = 5.66929133858268
            ws.PageSetup.Draft = False
            ws.PageSetup.Order = xlDownThenOver
            ws.PageSetup.FitToPagesTall = False
            ws.PageSetup.FitToPagesWide = False
            ws.PageSetup.CenterHorizontally = False
            ws.PageSetup.CenterVertically = False
            ws.PageSetup.PrintGridlines = False
            ws.PageSetup.PrintHeadings = False
            ws.Rows("7:55").RowHeight = 14.4
            ws.Rows("7:55").ColumnWidth = 2.89
            ws.Rows("67:115").RowHeight = 14.4
            ws.Rows("67:115").ColumnWidth = 2.89
            
            'Adapted Windows10 options
            If Win10 = 1 Then
            ws.PageSetup.Zoom = 96
            ws.PageSetup.TopMargin = 18
            ws.PageSetup.BottomMargin = 18
            
            Else
            ws.PageSetup.Zoom = 100
            ws.PageSetup.TopMargin = 0
            ws.PageSetup.BottomMargin = 0
            End If
            
        End If
    Next ws

    As you can see I just did a workaround but this can't be the solution.

    Also If I modify a picture the behavior is different for Windows 10, I use a factor to get around it:

    If Win10 = 1 Then
         Worksheets("Print").Shapes("Pic1").Height = 416.7026 * 1.04166666
         Worksheets("Print").Shapes("Pic1").Width = 762.3152 * 0.990043
    Else
         Worksheets("Print").Shapes("Pic1").Height = 416.7026
         Worksheets("Print").Shapes("Pic1").Width = 762.3152
    End if

    Otherwise it's not the same size in relation to the Cells.

    I think that could have the same reason but I really don't know and haven't found anything more about it.

    Thank you for your support!

    Tuesday, February 11, 2020 1:20 PM