Name Property

Applies To

AddIn object, Application object, AutoCaption object, AutoCorrectEntry object, AutoTextEntry object, Bookmark object, CaptionLabel object, CustomLabel object, Dictionary object, Document object, FileConverter object, FirstLetterException object, Font object, FormField object, Global object, Hyperlink object, Language object, ListEntry object, ListTemplate object, MailMergeDataField object, MailMergeDataSource object, MailMergeFieldName object, ReadabilityStatistic object, RecentFile object, Shape object, ShapeRange collection object, SpellingSuggestion object, Subdocument object, TableOfAuthoritiesCategory object, Task object, Template object, TwoInitialCapsException object, Variable object.

Description

Returns or sets the name for the specified object, as described in the following table.

Object

Description

AddIn, Dictionary, Document, FileConverter, RecentFile, Subdocument, Template, MailMergeDataSource

Returns the object's file name. Read-only String.

Application

Returns the name of the application (for example, "Microsoft Word"). Read-only String.

AutoCaption, CaptionLabel

Returns the name of the caption. Read-only String.

AutoCorrectEntry, AutoTextEntry

Returns or sets the name of the AutoCorrect or AutoText entry. Read/write String.

Bookmark

Returns the name of the bookmark. Read-only String.

CustomLabel

Returns or sets the name of the custom mailing label. Read/write String.

FirstLetterException, TwoInitialCapsException

Returns the word that is excepted from AutoCorrect actions. Read-only String.

Font

Returns or sets the name of the font. Read/write String.


(continued)

FormField

Returns or sets the name of the form field. Read/write String.

Language

Returns the name of the proofing tools language. Read-only String.

ListEntry

Returns or sets the name of the drop-down form field item. Read/write String.

ListTemplate

Returns or sets an optional list template name that can be used in conjunction with the Name instruction for a LISTNUM field. Read/write String.

MailMergeDataField, MailMergeFieldName

Returns the name of the mail merge field. Read-only String.

MailMergeDataSource

Returns the full name of the data source document. Read-only String.

Shape, ShapeRange

Returns or sets the shape name. Read/write String.

Hyperlink

Returns the friendly name (as it appears in the History folder) of the hyperlink. Read-only String.

ReadabilityStatistic

Returns the name of the readability statistic. Read-only String.

SpellingSuggestion

Returns the spelling suggestion. Read-only String.

TableOfAuthoritiesCategory

Returns or sets the name of the table of authorities category. Read/write String.

Task

Returns the task name. Read-only String.

Variable

Returns the document variable name. Read-only String.


See Also

FontNames property, FullName property, NameLocal property, Path property, PathSeparator property, UserName property.

Example

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