Software

Automating dates and times in a Word document

Letting Word enter a date or time for users is easy, but that can lead to frustration when Word doesn't perform as expected. Teach users about the less obvious aspects of these features or give them a macro.

Word offers a couple of features for entering the current date and time, but they can confuse users. With just a little training, you can eliminate that confusion. Or you can provide a couple of macros that do exactly what your users need, without the confusion the built-in features sometimes cause. You can use the Date And Time command or AutoComplete to enter the current date or time anywhere in a document. First, let's take a look at the Date And Time command. Basically, you just choose Date And Time from the Insert menu, choose a format, and click OK. However, there are a few things you need to know:
  • If you want the date to automatically update, you must check the Update Automatically option in the Date And Time dialog box.
  • The Update Automatically setting is a toggle switch. Once you select it, it stays enabled until you deselect it — and that can create confusion for users. They think they know what the setting is, so they don't check. Later, they're frustrated when the inserted value doesn't perform as expected.
  • The term automatically update is a bit deceptive. The inserted date will reflect the current date or time when you open the document. But if the date changes while the document is open, Word won't reflect that change. You can force the change by right-clicking the value and choosing Update Field from the context menu, but most users won't know that. Even if you tell them, they might not remember that detail when they need it.
A bit of spot-training can help, but unless this feature is something users rely on frequently, they are apt to forget all the above details. The other option is AutoComplete. You can enter the month or the current date and that alone confuses users. Again, just a bit of training can help:
  • Enter the first four letters of any month and press [Enter], and Word will complete the month. For instance, if you type Janu and press [Enter], Word will enter January for you.
  • To enter the current date, enter the full month, type a space, and press [Enter].
If AutoComplete doesn't work, someone has probably disabled the feature. To enable AutoComplete, choose AutoText from the Insert menu. Then, select AutoText and click the AutoText tab. Select the Show AutoComplete Suggestions option. If users know what to expect from both features, they're more apt to apply them correctly. Despite that, you might find users prefer a quick macro. The idea might seem like overkill — but if a simple macro eliminates user confusion and mistakes, a macro is worth the effort. The following macros insert the current date and time, respectively. Sub DateStamp() 'Insert the current date. Selection.InsertDateTime "MMMM dd, yyyy", False End Sub Sub TimeStamp() 'Insert the current time. Selection.InsertDateTime "hh:mm", False End Sub You can change the format to suit your needs. The False value enters the date or time as a string. If you change that argument to True, Word will treat the inserted date or time as a field value. Add a couple of custom buttons for both macros and take all the guesswork out of entering the current date and time.

About

Susan Sales Harkins is an IT consultant, specializing in desktop solutions. Previously, she was editor in chief for The Cobb Group, the world's largest publisher of technical journals.

Editor's Picks