I would like to have a macro which will save the contents of the currently active document in a pre-specified folder with a particular name. The name of the newly saved file should be made up of the Word Summary plus the Current Date. So that if I run this Macro on 13 September, this macro will save the current file as (C:\Test\Summary 13 September 2008. I have got code that will do exactly this and I provide a copy of that code at the end of this question. I now wish something else to be added to this code so that before the Macro saves the current file with a name made up of the word Summary and Current Date, I would like it to check if a file with that name already exists and if that is the case to then save this file instead with a slightly different name such as C:\Test\Summary 13 September 2008 B). Before the macro saves the file with this second name option, I would again like it to first check if a file with that second name option also already exists in the specified folder and, if it does, then the name of the file to be saved should be C:\Test\Summary 13 September 2008 C).
So if run for the first time today this macro will save the current file with the name C:\Test\Summary 13 September 2008); if run a second time today this macro will save the current file with the name C:\Test\Summary 13 September 2008 B); and if run a third time today it will save the current file with the name C:\Test\Summary 13 September 2008 C)
The code I have got at present which is saving the current file for me without checking if the file with the Specified name already exists is as follows:
Sub Test()
MyDir = "C:\TEST\"
Application.ActiveDocument
.BuiltInDo
cumentProp
erties(wdP
ropertySub
ject) = "Summary " & Format(Now, "dd MMMM yyyy")
Application.ActiveDocument
.SaveAs MyDir & "Summary " & Format(Now, "dd MMMM yyyy")
End Sub
Thanks for your help in anticipation.
Start Free Trial