Sub
pdf()
Dim
loLetzte
As
Long
last = ActiveSheet.Cells(Rows.Count, 1).
End
(xlUp).Row
Dim
dValue
As
String
dValue = TextBox1.Text
Dim
sPath
As
String
sPath = ThisWorkbook.Path
If
sPath =
""
Then
MsgBox
"Die Datei muß zuerst gespeichert werden"
Exit
Sub
End
If
sPath = IIf(Right$(sPath, 1) = Application.PathSeparator, sPath, sPath & Application. _
PathSeparator)
Dim
rng
As
Range
Set
rng = Blatt3.Range(
"A2:W"
& last)
On
Error
GoTo
ENDE
Application.DisplayAlerts =
False
Dim
PDF_NAME
As
String
PDF_NAME = dValue &
"_Export vom "
& Format(
Date
,
"dd.mm.yyyy"
) &
".pdf"
If
Not
PDF_NAME =
"Falsch"
Then
rng.ExportAsFixedFormat Type:=xlTypePDF, Filename:=PDF_NAME, Quality:=xlQualityStandard, _
IncludeDocProperties:=
True
, IgnorePrintAreas:=
False
, OpenAfterPublish:=
False
End
If
ENDE:
Application.DisplayAlerts =
True
MsgBox prompt:=
"Der Name der PDF lautet "
& PDF_NAME
End
Sub