ListFieldCounter 对象

         
ListFieldCounter

包含与列表中使用的关键计数器有关的信息。

说明

这个域由 Microsoft FrontPage 自动创建,用户不能修改。

使用 ListFieldCounter 对象

下列示例显示与当前列表中的计数器域相关的名称。

Sub ListCounterFields()
'Displays the name of counter fields in the current list

    Dim objApp As FrontPage.Application
    Dim objField As ListField
    Dim strType As String
    Dim blnFound As Boolean

    blnFound = False
    Set objApp = FrontPage.Application
    If Not ActiveWeb.Lists Is Nothing Then
        For Each objField In objApp.ActiveWeb.Lists.Item(0).Fields
            'Check if it is a computed field of type fpFieldFile
            If objField.Type = fpFieldCounter Then
                blnFound = True
                If strType = "" Then
                    'Create new string
                    strType = objField.Name & vbCr
                Else
                    'Add next field name to string
                    strType = strType & objField.Name & vbCr
                End If
            End If
        Next objField
        If blnFound = True Then
            MsgBox "The names of the fields in this list are: " & _
                    vbCr & strType
        Else
            MsgBox "There are no counter fields in the list."
        End If
    Else
        'Otherwise display message to user
        MsgBox "The current web contains no lists."
    End If
End Sub