I've been attempting to create a macro that creates a pdf for each worksheet beyond a certain sheet, that being sheet 6 onwards, but when it does create a pdf it creates them at different page sizes which I need them all to be the same size.
When I print and create a pdf in the regular way, it works but when its through the macro it doesn't.
Here is the code from said macro:
Sub exportToPDF()
Dim ws As Worksheet
Dim i As Long
Dim nm As String
Dim folder As String
folder = "\folder\"
For i = 6 To ThisWorkbook.Worksheets.Count
With ThisWorkbook.Worksheets(i)
nm = .Name
.ExportAsFixedFormat Type:=xlTypePDF, _
Filename:=folder & nm & ".pdf", _
Quality:=xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=False
End With
Next i
MsgBox ("Reports Printed")
End Sub
The size it should be at is A4 but the page being printed is much larger than the other ones which are printed manually when using this macro.
Any help with this would be greatly appreciated, and I can imagine the solution is fairly simple.