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?
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
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