Excel Mac ignoring custom page breaks in VBA

cc1987

New Member
Joined
Mar 4, 2016
Messages
16
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
 

Some videos you may like

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

Watch MrExcel Video

Forum statistics

Threads
1,122,241
Messages
5,595,017
Members
413,960
Latest member
ikkin

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