Excel Mac ignoring custom page breaks in VBA

cc1987

New Member
Joined
Mar 4, 2016
Messages
18
I use the below code to automate report production by looping through a named range.
It works fine on Excel Windows but on Mac it ignores the custom page breaks and applies a 37% scaling to the page also meaning a 3 page report turns into a 26 page report. Not sure why this is happening or if I need to explicitly set the page breaks and/or scaling within the VBA also?

VBA Code:
Public Sub PrintToPDF_combo()
Dim folderPath As String

folderPath = Application.ActiveWorkbook.Path

Set Rng = Range("def_nam")

For Each c In Rng

    Sheet5.Range("c16") = c

    'Debug.Print sI.Name
    'add export to PDF code here
   With Sheet3.PageSetup
   
    .Orientation = xlLandscape
    .PrintArea = Sheet3.Range("A1:Ae279" & lastRow).Address

    .FitToPagesWide = 1
    .FitToPagesTall = 3

    End With

   'This prints to C directory, change the path as you wish

   Sheet3.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
    folderPath & "/Reports/" & Sheet3.Range("G4").Text & "_" & _
        Format(Date, "dd mmm yyyy") & ".pdf", Quality:= _
    xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
    OpenAfterPublish:=False
   
Next

End Sub

Manually printing to PDF works fine on Mac and I have tried repeatedly setting the various print settings in the document but it just seems to ignore them when it comes to the VBA
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,534
Messages
5,832,299
Members
430,127
Latest member
JustDande

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