Hmmm! I am not sure how that takes us forward here. As I see it, the problem
is in the use of ActiveDocument.Name to rename the document. If the document
has not been saved this will result in
Document1 2010-03-01.docx
If the document has already been saved with that name the macro will save
with the name
Document1 2010-03-01.docx 2010-03-01.docx
You need to test whether the document has been saved and then if not prompt
for the part of the filename before the date. If then the document has been
saved, you could eliminate the date from the filename and add a new name.
This of course will delete any document of the same name saved on the same
date.
There seems little point showing the Dialog(wdDialogFileSaveAs) unless you
are going to offer the dated name to the user, and it will add confusion as
any name the user enters in the dialog will be overwritten. For a document
template for a particular task something like the following might suffice
Dim sName As String
Dim vName As Variant
With ActiveDocument
If Len(.Path) = 0 Then
.Save
sName = .name
'or instead of the previous 2 lines
'sName = InputBox("Enter filename (without the date)")
Else
vName = Split(.name, ".")
sName = Left(vName(0), Len(vName(0)) - 11)
End If
With Dialogs(wdDialogFileSaveAs)
.name = sName & " " & Format(Date, "yyyy-mm-dd")
.Show
End With
End With
If you want something a little more universally applicable - see
http://www.gmayor.com/save_numbered_versions.htm
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
My web site
www.gmayor.com
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>