Automatically locking a field?

J

John Salerno

Hi everyone. Is there a way that I can have a DATE field in my document such
that it automatically locks when the document is opened, instead of having
to lock it manually?

What I'm thinking is this: I have a memo template that I open and then save
as a new document when I write the memo. What I'd like to have happen is
that I have a DATE field in the memo template which locks when I open the
template, so that the date won't change anymore, then I save it as a new
document, etc. Then when I open the template again later for a new memo, the
field isn't really locked anymore because I never saved it the first time (I
saved it as a new document, I didn't actually change the memo template file
itself).

Is this possible?

Thanks!
 
J

Jay Freedman

Hi John,

That's the wrong approach to the solution. Instead, replace the DATE field
in the template with a CREATEDATE field. In each document based on the
template, that field will automatically -- and permanently -- display the
date the document (not the template) was created.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
J

John Salerno

Jay Freedman said:
Hi John,

That's the wrong approach to the solution. Instead, replace the DATE field
in the template with a CREATEDATE field. In each document based on the
template, that field will automatically -- and permanently -- display the
date the document (not the template) was created.

Thanks for the response. I might be using the word "template" wrong in this
context. It's not any kind of official Template document, it's basically
just a Word document with a few things filled in (such as the To and From
fields, since those are almost always the same). Then I just open this
document, save it as a new document, and edit it.

Does what you suggest work with this method, or is there perhaps a better
way for me to use a template than this?
 
S

Suzanne S. Barnhill

It actually would work if you use Save As, since the new document you're
saving would get a new creation date.
 
J

Jay Freedman

John said:
Thanks for the response. I might be using the word "template" wrong
in this context. It's not any kind of official Template document,
it's basically just a Word document with a few things filled in (such
as the To and From fields, since those are almost always the same).
Then I just open this document, save it as a new document, and edit
it.
Does what you suggest work with this method, or is there perhaps a
better way for me to use a template than this?

No, it won't work with that method, because the CREATEDATE field in that
case will always show the date the _original_ document was created. Creating
a new document from a template does set the field properly.

Open your pseudo-template document, change the field to CREATEDATE, click
File > Save As, change the "Save as type" dropdown in the dialog to
"Document Template (*.dot)", give it a name, and click OK. That makes an
"official" template. (Note: I'm assuming you don't have Word 2007, which is
a bit different.) Delete your pseudo-template document so you aren't tempted
to use it any more.

There are two ways you can use this template, with the same results.

(a) Click File > New, click "On my computer" in the task pain <er, pane>,
and double-click the template.[*]

(b) In Windows Explorer, go to %appdata%\Microsoft\Templates, right-click
your template, and choose Send To > Desktop (create shortcut). When you want
a copy of this document, double-click the shortcut on the desktop.

[*] This can be made less painful by adding a button to a toolbar that opens
the New Document dialog directly without going through the task pane. In
Tools > Customize > Commands, select the All Commands category, then find
the FileNewDialog command and drag it to a toolbar. Right-click it and
choose an icon. (See
http://www.word.mvps.org/FAQs/Customization/AsgnCmdOrMacroToToolbar.htm for
pictures.)

There are alternatives involving macros, but they're even more trouble to
set up and use.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
J

Jay Freedman

The trouble is that someday you'll forget and just Save instead of Save As,
and the date will be wrong. Of course, you can fix it by doing another Save
As, but it's annoying to have to remember.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
S

Suzanne S. Barnhill

And of course the workaround MS has devised for users who want to use
documents as pseudo-templates is the "From existing document" option in the
New Document task pane. To my mind, it would be a lot more trouble to
navigate to an existing document to use it this way than to just open the
New/Templates window and pick a template, but I guess it depends on how many
"templates" you have.
 
J

John Salerno

Jay Freedman said:
Open your pseudo-template document, change the field to CREATEDATE, click
File > Save As, change the "Save as type" dropdown in the dialog to
"Document Template (*.dot)", give it a name, and click OK. That makes an
"official" template. (Note: I'm assuming you don't have Word 2007, which
is a bit different.) Delete your pseudo-template document so you aren't
tempted to use it any more.

Well, I still save documents as Word 97-2003 format, so maybe it doesn't
matter that I have 2007. I was able to save my .doc "template" as a .dot
file, but I don't see any difference. What's the advantage to using an
actual template file instead of just using the .doc file?
 
J

John Salerno

Jay Freedman said:
There are two ways you can use this template, with the same results.

(a) Click File > New, click "On my computer" in the task pain <er, pane>,
and double-click the template.[*]

(b) In Windows Explorer, go to %appdata%\Microsoft\Templates, right-click
your template, and choose Send To > Desktop (create shortcut). When you
want a copy of this document, double-click the shortcut on the desktop.

Ok, I think I found one difference between the template and the regular
document. It seems when I open the template by double-clicking the file in
Windows Explorer, then click Save, the Save As dialog comes up, so I guess
it's impossible to save over it accidentally.

BUT, the way I normally open this file is to just go to the Recent Documents
list and choose it from there. Doing it this way doesn't seem to offer the
Save As dialog, so it IS possible to click Save and overwrite it. That sort
of defeats the point.
 
G

Graham Mayor

As you have already been told, change the document Date field to a
Createdate field ie ALT+F9 then add CREATE immediately before DATE with no
space. Press F9 to update and if necessary ALT+F9 to toggle the display to
show the result. Now save the document as a template in the trusted
templates location. When you need a new document of this type create a new
document from the template. The new document will always show the date *it*
was created.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


John said:
Jay Freedman said:
There are two ways you can use this template, with the same results.

(a) Click File > New, click "On my computer" in the task pain <er,
pane>, and double-click the template.[*]

(b) In Windows Explorer, go to %appdata%\Microsoft\Templates,
right-click your template, and choose Send To > Desktop (create
shortcut). When you want a copy of this document, double-click the
shortcut on the desktop.

Ok, I think I found one difference between the template and the
regular document. It seems when I open the template by
double-clicking the file in Windows Explorer, then click Save, the
Save As dialog comes up, so I guess it's impossible to save over it
accidentally.
BUT, the way I normally open this file is to just go to the Recent
Documents list and choose it from there. Doing it this way doesn't
seem to offer the Save As dialog, so it IS possible to click Save and
overwrite it. That sort of defeats the point.
 
S

Suzanne S. Barnhill

The default action for a .dot file is New rather than Open. If you'll look
at the title bar of the unsaved document, you'll see it is Documentx rather
than the name of the template. Therefore Save As is required. The same thing
happens if you use the "New from existing..." option in the New Document
window (Office Button | New), which allows Word to use a document as a
template. There are some things that can be saved only in templates, not in
documents, though this distinction has been continually eroded (it used not
to be possible to save macros in documents, for example).

The reason Jay mentioned Word 2007 is that in previous versions, when you
choose Document Template (*.dot) as the file type, Word defaults to the
default Templates folder, assuring that you will see the template in the New
dialog. In Word 2007, you have to explicitly choose a non-document folder
(but at least Trusted Templates is on the Places Bar). This is true
regardless of what format you're saving in.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

John Salerno said:
Jay Freedman said:
There are two ways you can use this template, with the same results.

(a) Click File > New, click "On my computer" in the task pain <er, pane>,
and double-click the template.[*]

(b) In Windows Explorer, go to %appdata%\Microsoft\Templates, right-click
your template, and choose Send To > Desktop (create shortcut). When you
want a copy of this document, double-click the shortcut on the desktop.

Ok, I think I found one difference between the template and the regular
document. It seems when I open the template by double-clicking the file in
Windows Explorer, then click Save, the Save As dialog comes up, so I guess
it's impossible to save over it accidentally.

BUT, the way I normally open this file is to just go to the Recent
Documents list and choose it from there. Doing it this way doesn't seem to
offer the Save As dialog, so it IS possible to click Save and overwrite
it. That sort of defeats the point.
 

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

Top