Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Automatically insert date into name of flle
Hello,
I am updating a particular file over and over again, and would like to have it automatically "save as a name with today's date - for example - title032708.doc today and if use it again tomorrow to save a new version as title032808.doc Is there any way to do this? Thanks! |
#2
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Automatically insert date into name of flle
"M" wrote:
Hello, I am updating a particular file over and over again, and would like to have it automatically "save as a name with today's date - for example - title032708.doc today and if use it again tomorrow to save a new version as title032808.doc Is there any way to do this? Yes, but you need a macro. A few things first... The macro checks if the document has been saved already. If not it exits. You must save it with a name in a proper folder first. Do not add the date at this stage. Then the macro checks if the document has been saved with a date before, if so, it removes the old date and adds today's date. If not, it just adds the date. So, if you use it twice in the same day, you will overwrite a previously saved file. If this is not desirable, you will need more code to check for that. If you have never used macros before, see: http://word.mvps.org/faqs/macrosvba/CreateAMacro.htm Here is the macro: Sub SaveWithDate() Dim strPath As String Dim strDate As String Dim strName As String With ActiveDocument If .Path = "" Then MsgBox "You must first save this document at least once " _ & "before using this function.", vbExclamation, "Cancelled" Exit Sub End If strPath = .Path strDate = Replace(CStr(Date), "/", "") strName = Left(.Name, Len(.Name) - 4) End With If Right(strName, 8) Like "########" Then 'Already been saved, replace date strName = Left(strName, Len(strName) - 9) 'Else, never been saved, just add date End If ActiveDocument.SaveAs strPath & Application.PathSeparator & strName _ & "_" & strDate & ".doc" End Sub |
#3
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Automatically insert date into name of flle
See http://www.gmayor.com/save_numbered_versions.htm
-- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org M wrote: Hello, I am updating a particular file over and over again, and would like to have it automatically "save as a name with today's date - for example - title032708.doc today and if use it again tomorrow to save a new version as title032808.doc Is there any way to do this? Thanks! |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Can I Insert a date that will automatically update when opened to 1MONTH FROM CURRENT DATE? | New Users | |||
Automatically insert date does not work. | Microsoft Word Help | |||
insert date automatically and save | Microsoft Word Help | |||
insert date automatically changes previous dates to new date? | Microsoft Word Help | |||
How do I get my autotext to automatically insert the date..again? | Microsoft Word Help |