Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
m m is offline
external usenet poster
 
Posts: 20
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
Jean-Guy Marcil[_2_] Jean-Guy Marcil[_2_] is offline
external usenet poster
 
Posts: 373
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default 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

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I Insert a date that will automatically update when opened to 1MONTH FROM CURRENT DATE? Dori New Users 2 February 21st 08 10:22 PM
Automatically insert date does not work. Rudy Microsoft Word Help 0 August 17th 07 01:46 AM
insert date automatically and save Ming Microsoft Word Help 2 October 12th 06 01:38 AM
insert date automatically changes previous dates to new date? Christopher92 Microsoft Word Help 2 May 5th 06 04:50 PM
How do I get my autotext to automatically insert the date..again? dae Microsoft Word Help 2 January 6th 06 04:19 PM


All times are GMT +1. The time now is 05:13 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"