AW: mehrere Tabellenblätter als PDF mit Name und D
31.07.2018 13:12:38
Michael
Hallo!
In der Recherche/im Archiv zu suchen ist mühsam, stimmt's? ;-).
Alle Blätter der Mappe als PDF einzeln speichern:
Sub a()
Dim Wb As Workbook: Set Wb = ThisWorkbook
Dim Ws As Worksheet, Pfad$
Pfad = "C:\DeinVerzeichnis\DeinUnterverzeichnis\"
Pfad = IIf(Right(Pfad, 1) = "\", Pfad, Pfad & "\")
For Each Ws In Wb.Worksheets
Ws.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=Pfad & Ws.Name & "-" & Date & ".pdf", _
quality:=xlQualityStandard, _
includedocproperties:=True, _
ignoreprintareas:=False, _
openafterpublish:=False
Next Ws
Set Wb = Nothing: Set Ws = Nothing
End Sub
Nur bestimmte Blätter der Mappe als PDF einzeln speichern:
Sub b()
Dim Wb As Workbook: Set Wb = ThisWorkbook
Dim aSh, i&, Pfad$
Pfad = "C:\DeinVerzeichnis\DeinUnterverzeichnis\"
Pfad = IIf(Right(Pfad, 1) = "\", Pfad, Pfad & "\")
aSh = Array("Tabelle7", "Tabelle12", "Tabelle21")
For i = LBound(aSh) To UBound(aSh)
With Wb.Worksheets(aSh(i))
.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=Pfad & aSh(i) & "-" & Date & ".pdf", _
quality:=xlQualityStandard, _
includedocproperties:=True, _
ignoreprintareas:=False, _
openafterpublish:=False
End With
Next i
Set Wb = Nothing: Erase aSh
End Sub
Pfad bzw. Blattnamen (b) musst Du selbst anpassen.
LG
Michael