Document.Fields Property (2007 System)

Gets a read-only Fields collection that contains the fields in the main text story.

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v9.0 (in Microsoft.Office.Tools.Word.v9.0.dll)

Syntax

'Declaration
<BrowsableAttribute(False)> _
Public ReadOnly Property Fields As Fields
'Usage
Dim instance As Document 
Dim value As Fields 

value = instance.Fields
[BrowsableAttribute(false)]
public Fields Fields { get; }
[BrowsableAttribute(false)]
public:
property Fields^ Fields {
    Fields^ get ();
}
public function get Fields () : Fields

Property Value

Type: Fields
A read-only Fields collection that represents all the fields in the main text story.

Examples

The following code example adds a date field to the first paragraph in the document.

This example is for a document-level customization.

Private Sub DocumentFields()
    Dim Type As Object = Word.WdFieldType.wdFieldDate
    Me.Paragraphs(1).Range.InsertParagraphAfter()
    Me.Fields.Add(Me.Paragraphs(1).Range, Type)
End Sub
private void DocumentFields()
{
    object Type = Word.WdFieldType.wdFieldDate;
    this.Paragraphs[1].Range.InsertParagraphAfter();
    this.Fields.Add(this.Paragraphs[1].Range, ref Type, ref missing, ref missing);
}

.NET Framework Security

See Also

Reference

Document Class

Document Members

Microsoft.Office.Tools.Word Namespace