Option
Explicit
Sub
PDF_erstellen_und_speichern()
Dim
xlSRange
As
Range
Dim
strZielPfad
As
String
Dim
strFileName
As
String
Dim
c
As
Range
Dim
d
As
Range
With
Worksheets(
"Projektübersicht"
).Columns(1)
Set
c = .Find(What:=Worksheets(
"Auftrag"
).Cells(2, 2), LookIn:=xlValues, lookat:=xlWhole)
If
Not
c
Is
Nothing
Then
MsgBox
"nummer gefunden"
& c.Row
Rem jetzt haut lt. diesem Code das VBA die Datei mit Namen
"Intern 00xx"
Rem und zwar in den Excel Standard-Speicherort
Rem Einstellung unter Menü/Datei/Optionen/Speichern
Rem steht da nix, oder ein unbekannter Eintrag - dann
Rem wird eben beim User/Dokumente abgelegt
Worksheets(
"Auftrag"
).ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=
"Intern"
&
" "
& Format(c.Row,
"0000"
), _
Quality:=xlQualityStandard, _
IncludeDocProperties:=
True
, _
IgnorePrintAreas:=
False
, _
From:=1,
To
:=1, _
OpenAfterPublish:=
False
Rem OK - der Kessel ist geflickt
strZielPfad =
"\\psf\Home\Desktop"
strFileName = Worksheets(
"Projektübersicht"
).Cells(c.Row, 3)
MsgBox
"Erfolgreich erstellt und gespeichert"
Else
MsgBox
"Kein Speichern möglich"
End
If
End
With
End
Sub