C
cjlanphear
How can I enter a date (any date) and have it display with the day of the week?
Field dialog.
week?Jay Freedman said:One of the formats of the \@ (Picture) switch can do that for any date
you can enter.
The first part is to get some way to enter the desired date into a
bookmark. For this you can use the Insert > Field dialog to create an
ASK field like this:
{ASK datebk "Enter date:"}
The ASK field is invisible when its field code is collapsed. When this
field is updated, it displays a box with the prompt -- in this case
"Enter date:" -- and a place to enter text, plus OK and Cancel
buttons. When you enter something and click OK, it creates or updates
a bookmark -- in this case, one named "datebk" -- inside the field.
The next part is to display the result with a QUOTE field like this:
{QUOTE {datebk} \@ "dddd"}
You must create the {datebk} field inside the QUOTE field by selecting
the word datebk and pressing Ctrl+F9 -- you can't do it in the Insert
When this field is updated, the current content of the datebk bookmark
is substituted for the inner field in the QUOTE field. Then the
Picture switch tells Word to display the day of the week corresponding
to that date.
I'd advise putting the ASK field and the QUOTE field right next to
each other. To use them, select the piece of text (the line,
paragraph, or the whole document) and press F9 to update the fields in
the selection. Or you can switch to Print Preview, which (depending on
an option setting) can update all fields in the document.
Be careful: there's no error checking of the entry in the ASK field.
When the box pops up, you could type in something that isn't a date,
or any nonsense characters. The ASK field won't care, but the QUOTE
field will usually just repeat what you typed rather than converting
it to a day name. The undesirable case is if you type something where
the beginning part could be interpreted as a date, so the QUOTE field
will display a day name but it could be wrong.
--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.
Hi Jay,
Simpler:
{FILLIN "Enter a date" \@ DDDD}
though I'd be inclined to take it one step further and use:
{FILLIN "Enter a date" \@ DDDD \d {DATE \@ "DD-MMM-YYYY"}}
Cheers
--
macropod
[MVP - Microsoft Word]
week?Jay Freedman said:One of the formats of the \@ (Picture) switch can do that for any date
you can enter.
The first part is to get some way to enter the desired date into a
bookmark. For this you can use the Insert > Field dialog to create an
ASK field like this:
{ASK datebk "Enter date:"}
The ASK field is invisible when its field code is collapsed. When this
field is updated, it displays a box with the prompt -- in this case
"Enter date:" -- and a place to enter text, plus OK and Cancel
buttons. When you enter something and click OK, it creates or updates
a bookmark -- in this case, one named "datebk" -- inside the field.
The next part is to display the result with a QUOTE field like this:
{QUOTE {datebk} \@ "dddd"}
You must create the {datebk} field inside the QUOTE field by selecting
the word datebk and pressing Ctrl+F9 -- you can't do it in the Insert
When this field is updated, the current content of the datebk bookmark
is substituted for the inner field in the QUOTE field. Then the
Picture switch tells Word to display the day of the week corresponding
to that date.
I'd advise putting the ASK field and the QUOTE field right next to
each other. To use them, select the piece of text (the line,
paragraph, or the whole document) and press F9 to update the fields in
the selection. Or you can switch to Print Preview, which (depending on
an option setting) can update all fields in the document.
Be careful: there's no error checking of the entry in the ASK field.
When the box pops up, you could type in something that isn't a date,
or any nonsense characters. The ASK field won't care, but the QUOTE
field will usually just repeat what you typed rather than converting
it to a day name. The undesirable case is if you type something where
the beginning part could be interpreted as a date, so the QUOTE field
will display a day name but it could be wrong.
--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.
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.