FirstLetterExceptions Collection Object

Microsoft Word Visual Basic

FirstLetterExceptions Collection Object

         
Application AutoCorrect
FirstLetterExceptions (FirstLetterException)

A collection of FirstLetterException objects that represent the abbreviations excluded from automatic correction.

Note   The first character following a period is automatically capitalized when the CorrectSentenceCaps property is set to True. The FirstLetterExceptions collection includes exceptions to this behavior (for example, abbreviations such as "addr." and "apt.").

Using the FirstLetterExceptions Collection

Use the FirstLetterExceptions property to return the FirstLetterExceptions collection. The following example deletes the abbreviation "addr." if it's included in the FirstLetterExceptions collection.

For Each aExcept In AutoCorrect.FirstLetterExceptions
    If aExcept.Name = "addr." Then aExcept.Delete
Next aExcept

The following example creates a new document and inserts all the AutoCorrect first-letter exceptions into it.

Documents.Add
For Each aExcept In AutoCorrect.FirstLetterExceptions
    With Selection
        .InsertAfter aExcept.Name
        .InsertParagraphAfter
        .Collapse Direction:=wdCollapseEnd
    End With
Next aExcept

Use the Add method to add an abbreviation to the list of first-letter exceptions. The following example adds the abbreviation "addr." to this list.

AutoCorrect.FirstLetterExceptions.Add Name:="addr."

Use FirstLetterExceptions(index), where index is the abbreviation or the index number, to return a single FirstLetterException object. The following example deletes the abbreviation "appt." from the FirstLetterExceptions collection.

AutoCorrect.FirstLetterExceptions("appt.").Delete

The following example displays the name of the first item in the FirstLetterExceptions collection.

MsgBox AutoCorrect.FirstLetterExceptions(1).Name