Private
Sub
Workbook_BeforeClose(Cancel
As
Boolean
)
Dim
myName
As
String
myName = Sheets(
"Tabelle1"
).Range(
"B1"
).Value & Format(
Date
,
"DDMMYY"
)
With
ThisWorkbook
If
Left(.Name, (InStrRev(.Name,
"."
, -1, vbTextCompare) - 1)) <> myName
Or
Not
.Saved
Then
If
MsgBox(
"Arbeitsmappe speichern"
, vbQuestion + vbYesNo) = vbYes
Then
Application.DisplayAlerts =
False
.SaveAs myName, .FileFormat
Application.DisplayAlerts =
True
End
If
End
If
End
With
End
Sub