Table of contents
TOC
Collapse the table of content
Expand the table of content

Fields Object (Publisher)

office 365 dev account|Last Updated: 8/24/2017
|
3 Contributors

A collection of Field objects that represent all the fields in a text range.

Remarks

The Count property for this collection in a publication returns the number of items in a specified shape or selection.

Example

Use the Fields property to return the Fields collection. Use Fields (index), where index is the index number, to return a single Field object. The index number represents the position of the field in the selection, range, or publication. The following example displays the field code and the result of the first field in each text box in the active publication.

Sub ShowFieldCodes() 
 Dim pagPage As Page 
 Dim shpShape As Shape 

 For Each pagPage In ActiveDocument.Pages 
 For Each shpShape In pagPage.Shapes 
 If shpShape.Type = pbTextFrame Then 
 With shpShape.TextFrame.TextRange 
 If .Fields.Count > 0 Then 
 MsgBox "Code = " & .Fields(1).Code & vbLf _ 
 & "Result = " & .Fields(1).Result & vbLf 
 End If 
 End With 
 End If 
 Next 
 Next 
End Sub

Methods

Name
AddHorizontalInVertical
AddPhoneticGuide
Item
Unlink

Properties

Name
Application
Count
Parent
© 2017 Microsoft