Want a template to automatically insert today's month in filename.

G

Gramma N

When I create a new document from a template I have, I would like the
filename it opens up as to include today's month and year. I have tried
using an = sign with the date function but the text just shows up as part of
the title instead of inserting the date. Is there a way to have the month
and year show up in a document title?
 
B

Beth Melton

You're close. Go to Insert/Field, select the CreateDate field and your
desired format. You nmay need to modify the format and remove the day (dd)
formatting code.

Note that the CreateDate will reflect the date the new document was created
and not the current date each time you open a saved document. If you want to
always see the current date, regardless of when the document was actually
created, then use the Date field instead.

Please post all follow-up questions to the newsgroup. Requests for
assistance by email cannot be acknowledged.

~~~~~~~~~~~~~~~
Beth Melton
Microsoft Office MVP

Coauthor of Word 2007 Inside Out:
http://www.microsoft.com/MSPress/books/9801.aspx#AboutTheBook

Word FAQ: http://mvps.org/word
TechTrax eZine: http://mousetrax.com/techtrax/
MVP FAQ site: http://mvps.org/
 
G

Gramma N

Thanks for responding Beth. But I am still not seeing how to do this. I
don't want to put the date on the document itself. I want to put the date in
the document name. In other words, I am calling my template "My File.xltx".
When I create a document from this template, it adds a number incrementally
to the name "My File 1.xltx". What I want it to do is add a month and a year
to that document name "My File August 2007.xltx". But I want it to add that
date automatically when I create the document from the template.

See the dilemma? I can't get a date field in the name of the document so it
will pick up the month and year when I create a new document. Where does the
program pick up the fact that there should be a "1" or "2" or "3" after the
file name? That would be the place to tell it to add that date instead of
the number. I just don't know where to even begin to look for that.

Thanks.
 
B

Beth Melton

I follow you now. The number that you see added when you create a new
document based on your template is added programmatically which is what
you'd need to do too. You need to do this with VBA, it can't be done in the
interface. What you'd need to do is intercept the Save As command and supply
your file name, by incrementing the last number used (this would be stored
either in a text file or perhaps the Registry if this is for your personal
use), and use the Format function to format the Date, using a format such as
"mmmm yyyy", and append it to the file name. Here's an article that provides
an example for your incrementing number that you can use and modify to fit
your needs:
http://pubs.logicalexpressions.com/pub0009/LPMArticle.asp?ID=32

Please post all follow-up questions to the newsgroup. Requests for
assistance by email cannot be acknowledged.

~~~~~~~~~~~~~~~
Beth Melton
Microsoft Office MVP

Coauthor of Word 2007 Inside Out:
http://www.microsoft.com/MSPress/books/9801.aspx#AboutTheBook

Word FAQ: http://mvps.org/word
TechTrax eZine: http://mousetrax.com/techtrax/
MVP FAQ site: http://mvps.org/
 
Top