Sub PRINT_TO_PDF_ALL()
Dim sName$
Dim Path$
sName = Sheets(Array("chauffeur", "self service", "totaal", "productie", "productie")).Select
Path = CreateObject("WScript.Shell").specialfolders("Desktop")
yearday = Format(DateDiff("d", CDate("1/1/" & Year(Now)), CDate(Now)) + 1, "000")
On Error Resume Next
ThisWorkbook.ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, _
Filename:=Path & "\" & yearday & "Bestelling" & " " & Format((ActiveSheet.Range("B2")), ""), _
openafterpublish:=True
If Err.Number > 0 Then MsgBox "Error saving pdf."
With ActiveSheet.PageSetup
.LeftMargin = Application.InchesToPoints(0.5)
.RightMargin = Application.InchesToPoints(0.5)
.TopMargin = Application.InchesToPoints(0.5)
.BottomMargin = Application.InchesToPoints(0.5)
.HeaderMargin = Application.InchesToPoints(0.2)
.FooterMargin = Application.InchesToPoints(0.1)
.PaperSize = xlPaperA4
.Orientation = xlPortrait
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
End Sub