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

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.

Forum statistics

Threads
1,214,960
Messages
6,122,479
Members
449,088
Latest member
Melvetica

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