Name Property

Returns or sets the name of the specified object.

Read/write String for the following objects: AutoCorrectEntry, AutoTextEntry, ColorFormat, CustomLabel, EmailSignatureEntry, Font, FormField, ListEntry, ListTemplate, Shape, ShapeRange, and TableOfAuthoritiesCategory; read-only String for all other objects in the Applies To list.


expression Required. An expression that returns one of the objects in the Applies To list.


This example adds a document variable to the active document and then displays the name of the first document variable.

ActiveDocument.Variables.Add Name:="Temp", Value:="1"
MsgBox ActiveDocument.Variables(1).Name

This example returns the name of the first bookmark in Hello.doc.

abook = Documents("Hello.doc").Bookmarks(1).Name

This example displays the names of the form fields in the active document.

If ActiveDocument.FormFields.Count >= 1 Then
    For Each FF In ActiveDocument.FormFields
        FFNames = FFNames & FF.Name & vbCr
    Next FF
    MsgBox FFNames
End If

This example formats the selection as Arial bold.

With Selection.Font
    .Name = "Arial"
    .Bold = True
End With

This example sets the name of the first list template used in the active document to "myList." A LISTNUM field (linked to the myList template) is then added at the insertion point. The field adopts the formatting of the myList template.

If ActiveDocument.ListTemplates.Count >= 1 Then
    ActiveDocument.ListTemplates(1).Name = "myList"
    Selection.Collapse Direction:=wdCollapseEnd
    ActiveDocument.Fields.Add Range:=Selection.Range, _
        Type:=wdFieldListNum, Text:="myList"
End If

Applies to | AddIn Object | Application Object | AutoCaption Object | AutoCorrectEntry Object | AutoTextEntry Object | Bookmark Object | CaptionLabel Object | ColorFormat Object | CustomLabel Object | CustomProperty Object | Dictionary Object | Document Object | Editor Object | EmailSignatureEntry Object | FileConverter Object | FirstLetterException Object | Font Object | FormField Object | Global Object | HangulAndAlphabetException Object | Hyperlink Object | Language Object | ListEntry Object | ListTemplate Object | MailMergeDataField Object | MailMergeDataSource Object | MailMergeFieldName Object | MappedDataField Object | OtherCorrectionsException Object | ReadabilityStatistic Object | RecentFile Object | Shape Object | ShapeRange Collection Object | SmartTag Object | SmartTagAction Object | SmartTagType Object | SpellingSuggestion Object | StyleSheet Object | Subdocument Object | TableOfAuthoritiesCategory Object | Task Object | Template Object | TwoInitialCapsException Object | Variable Object

See Also | FontNames Property | FullName Property | NameAscii Property | NameBi Property | NameFarEast Property | NameLocal Property | NameOther Property | Path Property | PathSeparator Property | UserName Property