应用于 Document、Range 和 Selection 对象的 Fields 属性。
返回一个只读 Fields 集合,该集合代表文档、区域或所选内容中的所有域。
expression.Fields
expression 必需。该表达式返回以上一个对象。
注意 当对 Document 对象应用 Fields 属性时,该属性返回一个 Fields 集合,该集合只包含文档正文中的域。
返回一个只读 MailMergeFields 集合,该集合代表指定文档中所有与邮件合并相关的域。
expression.Fields
expression 必需。该表达式返回一个 MailMerge 对象。
有关返回集合中单个成员的内容,请参阅返回集合中的对象。
当应用于 Document、Range 和 Selection 对象时。
本示例更新活动文档中所有的域。
ActiveDocument.Fields.Update
本示例删除活动文档正文和页脚中的所有域。
For Each aField in ActiveDocument.Fields
aField.Delete
Next aField
Set myRange = ActiveDocument.Sections(1).Footers _
(wdHeaderFooterPrimary).Range
For Each aField In myRange.Fields
aField.Delete
Next aField
本示例在插入点添加一个 DATE 域。
With Selection
.Collapse Direction:=wdCollapseStart
.Fields.Add Range:=Selection.Range, Type:=wdFieldDate
End With
当应用于 Document、Range 和 Selection 对象时。
本示例在插入点添加一个名为“Title”的邮件合并域。
Selection.Collapse Direction:=wdCollapseStart
ActiveDocument.MailMerge.Fields.Add Range:= Selection.Range, _
Name:= "Title"