Archives for January 26, 2012

Word of Law No. 7 – Using AutoText

[Originally appeared 1999]

Word of Law No. 5 introduced some of the issues that arise when a law practice or other large organization ties to balance personal and enterprise wide use of AutoText.

A full set of functional goals for AutoText can be intricate. There may be one or more standard collections of AutoText entries. Some may be used across the entire organization; others may be used on a departmental basis. Still others may be specific to a particular type document. Firm logos or letterhead mastheads could be organization-wide. A department might have phrases in common use in their work. In law practice, a litigation department might use the proper names of courts and agencies in which they practice. Alternative or optional text segments such as forms of notarizations for real estate documents can be maintained as AutoText in a specific document template.

The organizational AutoText entries may be changed from time to time, and the changes need to be distributed to users. Users should be able to create their own AutoText entries and see them if they log on at different computers. Each user should see their personal AutoText entries if they share a computer.

Several of you have written detailed descriptions of the strategies you have adopted to meet the challenge. A writer from one law firm described their use of Normal.dot. They maintain a master copy on their network, including the firm wide AutoText entries. User customization, including their own AutoText entries, are stored in their copies of Normal.dot, which are backed up automatically to their network. Corruptions of Normal.dot are addressed by replacing it with the backup personal copy, or, if necessary, the backup network copy.

A writer from Scotland described a very “organization-centric” approach that leaves out personalization. In this approach, the organization global templates are maintained in a network directory for which only a small number of administrators have permission to write files. All other users are read-only. This assures the integrity of the AutoText in the global templates.

We attempted a solution to personal AutoText based on a Firm.dot or FirmAutoText.dot file for the organization wide AutoText entries and other customization. Personal customization of AutoText entries, toolbars and macros were to be stored in a “Userid.dot” where “Userid” is the user’s network identification. An AutoExec macro that runs when word starts would have loaded the Userid.dot file as a global template, as well as setting the custom dictionary to “Userid.dic.” The AutoExec macro would also compare the time and date of each of Userid.dot and Userid.dic to identically named files stored on the network, and synchronize the files to the more current copy. This method would support portability, sharing of individual machines, and coordination with laptop usage. The file used a Windows API call that returns the UserID. While these concepts worked within the macro itself, we ran into problems with it in the client’s environment. The concepts seem valuable enough to be worth sharing to see if others may have pursued and achieved a similar solution.

It should be no surprise that the connections between AutoText entries and styles present challenges and opportunities. Word 97 includes special links between an AutoText entry and the style in which it was created. These support the operation of the AutoTextList Field and the AutoText inserter menu on the standard AutoText toolbar. An AutoText entry is characterized by the style in which it was created (if the AutoText entry is less than a paragraph) or by its first paragraph (if the AutoText entry consists of more than one paragraph). On the AutoText toolbar, the AutoText insertion menu lists either “All Entries” if the cursor is in a Normal style paragraph, or in a paragraph for which no AutoText entries have been classified, as described above. If there are such AutoText entries, the menu changes to the name of the current style, and a pull down can be accessed with the names of the styles classified to that style.

The AutoTextList field can also use the style linkages. It has a switch that allows a style to be specified. If AutoText Entries have been classified to the style, only the ones assigned to the style assigned to the field will appear as choices when right clicking on the field. If no style is assigned to the field, all AutoText entries will be accessed.

This technique is used in the sample letter template from Microsoft for the alternative forms of salutation and closing.

One needs to be careful about the styles of text being stored in an AutoText entry. If the AutoText entry uses styles of the same name as the document in which the AutoText is being inserted, the text will take on the formats of those styles in the receiving document. For documents constructed in accordance with the Laws of Styles stated in issue 20, this behavior will be correct under most circumstances. If the AutoText entry is supposed to have a distinctive appearance unrelated to the balance of the formatting in the recipient document, it should be formatted with a styles named specially for this purpose.

This can have subtle consequences, which we will explore further in future columns. Note that if AutoText is to be inserted through macro code, to cause the AutoText to be inserted with its stored styles applied requires the RichText:=True. Notice the use of this command in the code listed below.

AUTOTEXT LISTING

A complex set of AutoText entries needs a set of management tools. The AutoText entries can be printed using the “Print what:” setting of “AutoText entries.” A more interesting approach is to create a document that lists the names and content of a template’s AutoText entries. The following code will list all of the AutoText entries in a document’s attached template. Be very careful to save before running the macro, since the macro deletes the text of the current document. We will describe strategies for use of these documents in a future column.

Sub ListAllAutoText()
Dim aText As AutoTextEntry
Dim i
Selection.WholeStory
Selection.Delete
For Each aText In ActiveDocument.AttachedTemplate.AutoTextEntries
On Error GoTo CreateAutoTextNameStyle
Selection.TypeParagraph
Selection.TypeText (aText.Name)
Selection.Style = “AutoTextName”

StatusBar = “Creating AutoText Entry ” & aText.Name
Selection.TypeParagraph

Selection.Style = “Normal”
aText.Insert Where:=Selection.Range, RichText:=True
Next aText
Selection.Style = “Normal”
Selection.TypeBackspace
Exit Sub

CreateAutoTextNameStyle:
ActiveDocument.Styles.Add Name:=”AutoTextName”, Type:=wdStyleTypeParagraph
Resume

End Sub

This 1999 article originally appeared in Office Watch.  Subscribe to Office Watch free at http://www.office-watch.com/.