Value Property

Microsoft Word Visual Basic

Show All

Value Property

       

Value property as it applies to the AutoCorrectEntry, AutoTextEntry, CustomProperty, and Variable objects.

Returns or sets the value of the AutoCorrect entry, AutoText entry, custom property, or document variable. Read/write String.

expression.Value

expression   Required. An expression that returns one of the above objects.

Remarks

For AutoCorrectEntry and AutoTextEntry objects, the Value property only returns the first 255 characters of the object's value. Setting the Value property to a string longer than 255 characters generates an error.

Value property as it applies to the DropDown object.

Returns or sets the number of the selected item in a drop-down form field. Read/write Long.

expression.Value

expression   Required. An expression that returns a DropDown object.

Value property as it applies to the MailMergeDataField and MappedDataField objects.

Returns the contents of the mail merge data field or mapped data field for the current record. Use the ActiveRecord property to set the active record in a mail merge data source. Read-only String.

expression.Value

expression   Required. An expression that returns one of the above objects.

Value property as it applies to the CheckBox object.

True if the check box is selected. Read/write Boolean.

expression.Value

expression   Required. An expression that returns a CheckBox object.

Value property as it applies to the ReadabilityStatistic object.

Returns the value of the grammar statistic. Read-only Long.

expression.Value

expression   Required. An expression that returns a ReadabilityStatistic object.

Example

As it applies to the AutoCorrectEntry, AutoTextEntry, CustomProperty, and Variable objects.

This example adds a document variable to the active document and then displays the value of the new variable.

ActiveDocument.Variables.Add Name:="Temp2", Value:="10"
MsgBox ActiveDocument.Variables("Temp2").Value

This example creates an AutoCorrect entry and then displays the value of the new entry.

AutoCorrect.Entries.Add Name:="i.e.", Value:="that is"
MsgBox AutoCorrect.Entries("i.e.").Value

As it applies to the MailMergeDataField and MappedDataField objects.

This example displays the contents of the active data record in the data source attached to Main.doc.

For Each dataF In _
    Documents("Main.doc").MailMerge.DataSource.DataFields
    If dataF.Value <> "" Then dRecord = dRecord & _
        dataF.Value & vbCr
Next dataF
MsgBox dRecord

As it applies to the ReadabilityStatistic object.

This example checks the grammar in the active document and then displays the Flesch reading-ease index.

ActiveDocument.CheckGrammar
MsgBox ActiveDocument.ReadabilityStatistics( _
    "Flesch Reading Ease").Value