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

Field Object (Publisher)

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

Represents a field. The Field object is a member of the Fields collection. The Fields collection represents the fields in a selection, range, or publication.

Remarks

The pbFieldPageNumber constant is a member of the PbFieldType group of constants, which includes all the various field types.

Example

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 counts the number of fields in the active publication and displays the count in a message.

Sub CountFields() 
 Dim pagPage As Page 
 Dim shpShape As Shape 
 Dim fldField As Field 
 Dim intFields As Integer 
 Dim intCount As Integer 

 For Each pagPage In ActiveDocument.Pages 
 For Each shpShape In pagPage.Shapes 
 If shpShape.Type = pbTextFrame Then 
 intCount = intCount + shpShape.TextFrame.TextRange.Fields.Count 
 End If 
 Next 
 Next 
 If intCount > 0 Then 
 MsgBox "You have " & intCount & " fields in your publication." 
 Else 
 MsgBox "You have no fields in your publication." 
 End If 
End Sub

Methods

Name
Unlink

Properties

Name
Application
Code
Next
Parent
PhoneticGuide
Result
TextRange
Type
© 2017 Microsoft