Class Field (Word VBA)
The class Field represents a field. The Field object is a member of the Fields collection. The Fields collection represents the fields in a selection, range, or document.
The classes InlineShape and Selection. give access to class Field
Dim fld as Field
Set fld = ActiveDocument.Fields(Index:=1)
For Each
Here is an example of processing the Field items in a collection.
Dim fld As Field
For Each fld In ActiveDocument.Fields
If fld.LinkFormat.AutoUpdate = False Then fld.LinkFormat.Update
Next fld
Methods
Copy - Copies the specified field to the Clipboard.
Cut - Removes the specified field from the document and places it on the Clipboard.
Delete - Deletes the specified field.
DoClick - Clicks the specified field.
Select - Selects the specified field.
Unlink - Replaces the specified field with its most recent result.
Update - Updates the result of the field. Returns True if the field is updated successfully.
UpdateSource - Saves the changes made to the results of an INCLUDETEXT field back to the source document.
Properties
Code (Default member) - Returns a Range object that represents a field's code.
Data returns or sets data in an ADDIN field.
Index returns a Long that represents the position of an item in a collection.
InlineShape returns an InlineShape object that represents the picture, OLE object, or ActiveX control that is the result of an INCLUDEPICTURE or EMBED field.
Kind returns the type of link for a Field object.
LinkFormat returns a LinkFormat object that represents the link options of the specified field. Read/only.
Locked true if the specified field is locked.
Next returns the next object in the collection.
OLEFormat returns an OLEFormat object that represents the OLE characteristics (other than linking) for the specified field.
Previous returns the previous object in the collection.
Result returns a Range object that represents a field's result.
ShowCodes true if field codes are displayed for the specified field instead of field results.
Type returns the field type.
Related Classes
InlineShape - Represents an object in the text layer of a document. An inline shape can only be a picture, an OLE object, or an ActiveX control. The InlineShape object is a member of the InlineShapes collection. The InlineShapes collection contains all the shapes that appear inline in a document, range, or selection.
LinkFormat - Represents the linking characteristics for an OLE object or picture.
OLEFormat - Represents the OLE characteristics (other than linking) for an OLE object, ActiveX control, or field.
Range - Represents a contiguous area in a document. Each Range object is defined by a starting and ending character position.