Thread: Date/Time Field
View Single Post
  #6   Report Post  
Posted to microsoft.public.word.docmanagement
Rosemary Rosemary is offline
external usenet poster
 
Posts: 53
Default Date/Time Field

Thank you, Suzanne

"Suzanne S. Barnhill" wrote:

An ordinary DATE field would update each time the document was opened (or at
least any time that fields were updated, as when printing or switching to
Print Preview or, if it was in the header or footer, every time the document
was repaginated). Someone with some VBA knowledge will have to interpret the
macro for you; ASCII character 31 is a nonprinting character, "unit
separator," apparently used in Word as the "optional hyphen" (Ctrl+-).

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

"Rosemary" wrote in message
...
Hi again,

Here is the code for the date field -- I think the line I am curious about

is:
Selection.TypeText Text:=Chr(31)

'Date
With Selection
.Style = ActiveDocument.Styles("Normal")
If chkDate.Value = True Then 'they checked insert as field
.InsertDateTime DateTimeFormat:="MMMM d, yyyy",
InsertAsField:=True
Selection.TypeText Text:=Chr(31)
ElseIf chkDate.Value = False Then 'they did not check insert as
field
.TypeText Text:=txtDDate.Value
End If
.TypeParagraph
End With

Best regards,
Rosemary

"Rosemary" wrote:

Hi Suzanne,

Thank you - that was very helpful. The site explained the differences

very
well.

What we have in the template I talked about is a date code that updates
every time you open the document (which is what we need - sorry, I may

not
have explained clearly).

I noticed the site said you can update on print, but not necessarily on
opening the document. I believe that "hyphen-like" character that

appears
just after the date code, included by the template's creator, is what

gets
the field to update each time the document is opened ...?

Regards,
Rosemary



"Suzanne S. Barnhill" wrote:

For inserting a date in the header or footer, there is an Insert Date

button
on the Header and Footer toolbar (this button could also be added to

any
toolbar). Anywhere in a document, you can use the Alt+Shift+D keyboard
shortcut. Both the button and the shortcut insert a DATE field using

the
format you have selected as the default in the Insert | Date and Time
dialog.

Note, however, that a DATE field is probably not what you want. What

you
describe is a CREATEDATE field. For more on date fields, see
http://word.mvps.org/FAQs/TblsFldsFms/DateFields.htm. There is no

built-in
shortcut for inserting this field, but you can insert the field in the

usual
way (by hand or through the Insert | Field dialog), formatted as

desired,
and then save it as an AutoText entry; see
http://word.mvps.org/FAQs/Customization/AutoText.htm. Once you've

created
the AutoText entry, there are several ways you can insert it. The

usual way
is just to type the first four letters of the entry name (which should

be
something you wouldn't otherwise be typing) and press Enter or (in

Word
2007) F3, but you can also assign a keyboard shortcut or toolbar

button
through Tools | Customize in versions before Word 2007.

For letters and other documents that should always include the

creation
date, put the CREATEDATE field in the document template. It will not

update
in the template itself but will show the creation date of each

document
based on the template.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the

newsgroup so
all may benefit.

"Rosemary" wrote in message
...
Hi,

Two questions please:

We have Windows XP and Word 2003

1. How can I create a quick keystroke or toolbar button to put a

basic
date
code (e.g., November 11, 2007) in my document?

2. I am curious about a technical aspect of the automatically

updating
date/time field. I saw a template where a date code was inserted

when you
created it. But the date code had a hyphen-like character (code?)

just
after
the field. Someone told me that the field doesn't know to

automatically
update unless this hyphen-like character/code is there. But when I

put a
date field in my document by going thru the Insert menu, I don't see

a
character like that appearing after the code. Can someone tell me

what
that
"hyphen" actually is, and how it works?

Thanks!
Rosemary