One-time date macro?

  • Thread starter Thread starter George
  • Start date Start date
G

George

Is there a Macro that can be activated "upon opening" a template so that it
will put today's date permanently in the document. I want it to keep the
date first put in, as plain text. I don't want the "auto-date" thing
because it keeps updating every future time you open the document. If the
template was used to create a certain document on August 18th, the final
saved document on that day should forever say... August 18th (in plain text
characters), not be a function and not update the date every time it's
reopened.

Also, is there a macro that caused the cursor to go to a certain spot in the
template.(like suppose it's a letter template, and I'd like the cursor to
skip down to the "Dear ____:" area.


Thanks,

George
 
George said:
Is there a Macro that can be activated "upon opening" a template so
that it will put today's date permanently in the document. I want it
to keep the date first put in, as plain text. I don't want the
"auto-date" thing because it keeps updating every future time you
open the document. If the template was used to create a certain
document on August 18th, the final saved document on that day should
forever say... August 18th (in plain text characters), not be a
function and not update the date every time it's reopened.

Also, is there a macro that caused the cursor to go to a certain spot
in the template.(like suppose it's a letter template, and I'd like
the cursor to skip down to the "Dear ____:" area.

Hi George,

For the date, don't bother with a macro. Instead, insert a CreateDate field
in the template. When you view the template, it will show the date the
template was created. When you use File > New to create a document based on
the template, the field will show the date the *document* was created. It
will never change -- in fact, you can go back to an old document and insert
a CreateDate field there, and it will show the correct creation date for
that document.

For the other item, insert a bookmark in the template at the place you want
to start typing. You can call it something like StartHere. Then add a macro
to the template:

Public Sub AutoNew()
ActiveDocument.Bookmarks("StartHere").Select
End Sub
 
Thanks, Jay, great idea. I looked up CreateDate in MSWord Help and saw the
syntax.

I know I'm missing something because I opened a tempate and tried inserting
(by typing the characters) all of these below, but nothing worked after I
saved the template (as a .dot file) and then reopened it as if I were about
to create a document:

{CREATEDATE}
{CREATEDATE \@ "MMMM d, yyyy"}
{ CREATEDATE \@ "Date-Time Picture"}

Thanks for any suggestions,
George
 
George,

The braces in a field {} can't be typed manually - Word interprets that as
literal text. To insert a blank pair of field braces in your template,
press Ctrl + F9. Then type the rest of the field code between them, and
Shift + F9 to toggle the field code to a field result. When you create a
document from the template, the field may not immediately reflect the
CreateDate. You can manually update it by right-clicking it and choosing
the 'Update field' command or by left-clicking in it and pressing F9. Or
you can wait until it automatically updates when you print or when you save,
close, and reopen.

Regards,
Chad
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top