AW: VBA: bestimmtes Blatt als pdf speichern, Name Message Box
{Boris}
Hi,
auf die Schnelle:
Option Explicit
Sub Blatt_als_pdf_speichern()
Dim sFilename As Variant
Const sPath As String = "C:\users\boris\downloads\" 'hier den Speicherpfad angeben
Const WS As String = "Tabelle1" 'Name des Tabellenblattes
On Error GoTo ERR_HANDLER
sFilename = Application.InputBox("Bitte Datei benennen (ohne pdf als Endung)", "Dateiname")
If sFilename = False Then Exit Sub
' PDF erstellen und speichern
Worksheets(WS).ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
sPath & sFilename & ".pdf", Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
MsgBox "Erledigt.", vbInformation, "Erfolgsmeldung"
Exit Sub
ERR_HANDLER:
MsgBox "Das hat leider nicht geklappt.", vbInformation, "Hinweis"
End Sub
VG, Boris