Fields Property
Returns a ListFields collection that represents all fields in the current list. The ListFields collection contains ListField objects that correspond to the column properties of a list member document.
expression.Fields
expression Required. An expression that returns one of the objects in the Applies To list.
Example
The following example displays the names of all fields in the first list of the Lists collection.
Sub DisplayFields()
'Returns the fields collection
Dim objApp As FrontPage.Application
Dim lstWebList As List
Dim lstFields As ListFields
Dim lstField As ListField
Dim StrName As String
Set objApp = FrontPage.Application
Set lstWebList = objApp.ActiveWeb.Lists.Item(0)
Set lstFields = lstWebList.Fields
If Not ActiveWeb.Lists Is Nothing Then
For Each lstField In lstFields
'add URLs to string
If StrName = "" Then
'If empty string
StrName = lstField.Name & vbCr
Else
'add names to string
StrName = StrName & lstField.Name & vbCr
End If
Next
'Display formatted string
MsgBox "The list " & lstWebList.Name & _
"contains the following fields" & vbCr & vbCr & _
StrName
Else
'Otherwise display message to user
MsgBox "The current web contains no lists."
End If
End Sub