mit folgendem Code erzeuge ich wie gewünscht PDF's. Nun ist es so, dass die erzeugten PDF's immer 8 Seiten beinhalten, obwohl nur 3, 4 oder auch 6 Seiten mit Inhalt sind. Gibt es eine Möglichkeit die leeren Seiten nicht zu erzeugen? Gruß, Marko
Private Sub CommandButton20_Click()
CommandButton2.Caption = "PDF erzeugen"
With Application
.ScreenUpdating = False
.EnableEvents = False
.Calculation = xlCalculationManual
End With
Dim strFilename As String
strFilename = Environ("USERPROFILE") & "\Documents\" & "\KoBo\" & Sheets("Tabelle3").Range("L20").Text & ".pdf"
If Dir(strFilename) = "" Then
Sheets("Tabelle1").Calculate
Sheets("Tabelle3").Calculate
Sheets("Tabelle3").Range("K65:K381").AutoFilter Field:=1, Criteria1:="x", visibledropdown:=False
Sheets("Tabelle3").ExportAsFixedFormat Type:=xlTypePDF, _
Filename:=strFilename, Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, _
OpenAfterPublish:=False
Else
MsgBox "Diese PDF-Datei existiert bereits", vbOKOnly + vbInformation, "Hinweis"
End If
Sheets("Tabelle3").Range("M2").FormulaLocal = "=I9"
MsgBox "Die vorläufige Bonusabrechnung wurde erfolgreich erstellt!", vbInformation, "PDF erzeugen"
With Application
.ScreenUpdating = True
.EnableEvents = True
.Calculation = xlCalculationAutomatic
End With
End Sub