Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
dakke dakke is offline
external usenet poster
 
Posts: 5
Default Automatic Date and time in word document title

Is there a way to include the date and time in the title of the document in
that way that each time you save the document the data and time are updated
and as such stored as a brandnew file?

eg:
Document title: Test 11-1-2008 11:12 pm.doc
Modify and work on another day making it:
Test 13-1-2008 08:32 pm.doc

All without manually updating the file name?
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default Automatic Date and time in word document title

Create a macro called FileSave()

Dim fname as String
fname = InputBox("Enter the filename", "File Save As")
With ActiveDocument
.Variables("varfname").Value = fname
.SaveAs fname & Format(Now(), "dd-M-yyyy hh:mm AMPM")
End With

and for the subsequent saves a macro called FileSaveAs()

With ActiveDocument
.SaveAs .Variables("varfname").Value & Format(Now(), "dd-M-yyyy hh:mm
AMPM")
End With

If you put these macros in a Global template, they corresponding one will
run whenever you use the FileSaveAs or FileSave command.



--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"dakke" wrote in message
...
Is there a way to include the date and time in the title of the document
in
that way that each time you save the document the data and time are
updated
and as such stored as a brandnew file?

eg:
Document title: Test 11-1-2008 11:12 pm.doc
Modify and work on another day making it:
Test 13-1-2008 08:32 pm.doc

All without manually updating the file name?



  #3   Report Post  
Posted to microsoft.public.word.docmanagement
dakke dakke is offline
external usenet poster
 
Posts: 5
Default Automatic Date and time in word document title

Thanks for the reply.

I'm not familar with macro's, but this is the error I got:
Run-time error '5152';
This is not a valied file name.
Try on of the following:
* Check the path to make sure it was typed correctly.
* Select a file from the list of files and folders.
(test16-1-2008 02:47 PM)


Here's the macro I created based on your advice:

Sub Filesave()
Dim fname As String
fname = InputBox("Enter the filename", "File Save As")
With ActiveDocument
..Variables("varfname").Value = fname
..SaveAs fname & Format(Now(), "dd-M-yyyy hh:mm AMPM")
End With
End Sub

Sub FilesaveAs()
End Sub
With ActiveDocument
.SaveAs .Variables("varfname").Value & Format(Now(), "dd-M-yyyy hh:mm AMPM ")
End With
End Sub

So I think it kinda does a thing that comes close, but...
It also pops up a window asking to 'Enter the filename', which it shouldnt
do ideally since it should take the 'actual' filename and simply update the
date and time. Should have been more clear on this. However, entering the
filename does not work: 'test', 'test.doc' doesn't do a thing.
Is there a way to do this (might be useful to create a field with the title
like 'test' and that the macro grabs the field and adds the data and time)

Your help is much appreciated, but also points out that I really need to
learn more about the macro's.
  #4   Report Post  
Posted to microsoft.public.word.docmanagement
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default Automatic Date and time in word document title

Oops, the colon is causing the problem. Replace it in the Format() function
with something else that suits your fancy.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"dakke" wrote in message
...
Thanks for the reply.

I'm not familar with macro's, but this is the error I got:
Run-time error '5152';
This is not a valied file name.
Try on of the following:
* Check the path to make sure it was typed correctly.
* Select a file from the list of files and folders.
(test16-1-2008 02:47 PM)


Here's the macro I created based on your advice:

Sub Filesave()
Dim fname As String
fname = InputBox("Enter the filename", "File Save As")
With ActiveDocument
.Variables("varfname").Value = fname
.SaveAs fname & Format(Now(), "dd-M-yyyy hh:mm AMPM")
End With
End Sub

Sub FilesaveAs()
End Sub
With ActiveDocument
.SaveAs .Variables("varfname").Value & Format(Now(), "dd-M-yyyy hh:mm AMPM
")
End With
End Sub

So I think it kinda does a thing that comes close, but...
It also pops up a window asking to 'Enter the filename', which it shouldnt
do ideally since it should take the 'actual' filename and simply update
the
date and time. Should have been more clear on this. However, entering the
filename does not work: 'test', 'test.doc' doesn't do a thing.
Is there a way to do this (might be useful to create a field with the
title
like 'test' and that the macro grabs the field and adds the data and time)

Your help is much appreciated, but also points out that I really need to
learn more about the macro's.



  #5   Report Post  
Posted to microsoft.public.word.docmanagement
dakke dakke is offline
external usenet poster
 
Posts: 5
Default Automatic Date and time in word document title

Yes, it works.

Now tweak it a little and done.

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
Disable automatic date/time update krupscafe Microsoft Word Help 3 November 1st 06 02:19 PM
Date and time info not being saved in document versions - Word 200 martin Microsoft Word Help 2 October 2nd 06 06:29 AM
can current date be automatic on document template when loaded? Schola Microsoft Word Help 1 June 28th 06 04:51 AM
date/time automatic update is off but date still updates. jocasam Microsoft Word Help 2 February 11th 06 03:50 PM
Can I time/date stamp a read-only section of a Word document? Jan W., Chicago Microsoft Word Help 1 October 29th 05 04:00 AM


All times are GMT +1. The time now is 08:17 AM.

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

About Us

"It's about Microsoft Word"