Verzeichnisname = Format(
Date
,
"yyyy"
)
Verzeichnisname2 = Format(Time,
"HH_MM"
)
Pfad = "G:\Excel\" & Verzeichnisname
Pfad2 = Pfad &
"\" & Range("
J1")
Ext =
".xlsm"
Dim
sTitle
As
String
sTitle =
"Bedarfsanzeige nicht vollständig"
If
IsEmpty(Sheets(
"Bedarfsanzeige"
).Range(
"Anforderer"
))
Then
MsgBox prompt:=
""
& Chr(13) &
"> Anforderer Name fehlt"
, Title:=sTitle
GoTo
LastLine
End
If
If
IsEmpty(Sheets(
"Bedarfsanzeige"
).Range(
"F6"
))
Then
MsgBox prompt:=
""
& Chr(13) &
"> Verwendungszweck nicht vorhanden"
, Title:=sTitle
GoTo
LastLine
End
If
Worksheets(
"Bedarfsanzeige"
).Range(
"N1"
).Value = 1
If
Dir(Pfad, vbDirectory) =
""
Then
MkDir Pfad
If
Dir(Pfad2, vbDirectory) =
""
Then
MkDir Pfad2
neuname = Pfad2 &
"\" & Range("
J1
") & "
_
" & Range("
J3
") & "
_
" & Range("
J2
") & "
_
" & Range("
H7
") & "
_" & Verzeichnisname2
neuname = Replace(neuname,
"__"
,
"_"
)
If
Dir(neuname & Ext) <>
""
Then
neuname = neuname &
"_"
& Second(Time) & Ext
ThisWorkbook.SaveAs neuname, FileFormat:=xlOpenXMLWorkbookMacroEnabled
LastLine: