Software

Add helpful information fields to a shared document

To display specific information about a shared Word document including its author, you can use the fields feature.

When you share documents with others, it's helpful to identify the document in various ways. You could display the document's file or author name, when the file was created or last revised, and by whom. Fortunately, using Word fields, displaying this type of information is easy.

First, decide where you want to display this type of information. Most likely, you'll want to do so in the header or footer, but you can display it anywhere you like. Next, you'll add the fields, as follows:

  1. To open the header in Word 2010 and 2007, double-click the top margin area. In Word 2003, choose Header and Footer from the View menu.
  2. Position the cursor where you want to display the information in the header area, say, the left margin.
  3. Click Insert and choose Field from the Quick Parts option in the Text group. In Word, choose Field from the Insert menu.
  4. Choose Document Information or (All). (User Information also displays helpful data.)
  5. In the Fields list, double-click the Author field. Word will display the document's author in the document's header.
  6. Press Enter and repeat the process, choosing FileName and then LastSavedBy (which in this case, is the same as the author, but that won't always be the case.)

It's easy enough to include this type of information, but you might run into a problem. Fields don't update automatically. For instance, if you change the document's name, the FileName field will continue to display the document's previous file name until you update the FileName field. To update a field, simply select it and press [F9]. There's your problem - you must remember to update the field to display the most up-to-date information!

You can add a macro that updates all of the document's field, but you must remember to execute it. If you forget, you end up distributing a document with the wrong information in the header. I don't have a solution that doesn't require a bit of user attention. Whether you create a macro button or attach the following macro to the file's open or close process, the potential exists for an error of inattention:

Sub AutoOpen()
 'Update fields when opening document.
 Dim rngStory As Range
 Dim fld As Field
 For Each rngStory In ActiveDocument.StoryRanges
 For Each fld In rngStory.Fields
 fld.Update
 Next fld
 Next rngStory
End Sub 

This macro cycles through the StoryRanges collection, which references nearly everything in the document. Consequently, this macro updates every field in the document, so keep that in mind when applying it—that might not be what you want to do. Opening the file will execute it automatically.

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.

0 comments

Editor's Picks