You can use use GetSaveAsFilename to get the saveAs filename then test the result before saving
This will not give you exactly what you want
Testing for mmdd would take more coding
Sub FileSaveAs()
Dim sFile As String
Dim sFname As String
Dim bFnameTestFail As Boolean
GetFileName:
'get path & filename
sFile = Application.GetSaveAsFilename(fileFilter:="Excel Files (*.xls), *.xls")
'test for cancel button selection
If sFile = "False" Then
Exit Sub
End If
'test file name
If Not Len(sFname) = 13 Then
MsgBox "Incorect file name format"
End If
If Not IsNumeric(Left(sFname, 4)) Then
MsgBox "Incorect file name format"
End If
If Not Mid(sFname, 5, 1) = "-" Then
MsgBox "Incorect file name format"
End If
If Not IsNumeric(Mid(sFname, 6, 4)) Then
MsgBox "Incorect file name format"
End If
If bFnameTestFail = True Then
MsgBox "Incorect file name format"
GoTo GetFileName
End If
ActiveWorkbook.SaveAs Filename:=sFile
End Sub
Bookmarks