BasicList Object

Contains information about the basic list type used within the application.


The BasicList object allows users to share and categorize information between Web sites.

Use Lists(Index), where Index is either the name of the basic list or its numeric position within the collection, to return a single Basic List object. The following example displays the names of all basic lists in the active Web site. If the Web site contains no lists, a message is displayed to the user.

Visual Basic for Applications
Sub ListAllLists()
'Displays the names of all basic lists in the collection

    Dim lstWebList As List
    Dim strName As String
    Dim blnFound As Boolean

    'Set found flag to false
    blnFound = False
    'Check if any lists exist and, if so cycle through them
    If Not ActiveWeb.Lists Is Nothing Then
        For Each lstWebList In ActiveWeb.Lists
            If lstWebList.Type = fpListTypeBasicList Then
                'Set boolean flag to found and names to string
                blnFound = True
                If strName = "" Then
                    strName = lstWebList.Name & vbCr
                    strName = strName & lstWebList.Name & vbCr
                End If
            End If
        If blnFound = True Then
            'Display names of all basic lists
            MsgBox "The names of all basic lists in the current Web are:" _
                   & vbCr & strName
            MsgBox "There are no basic lists in the current Web."
        End If
        'Otherwise display message to user
        MsgBox "The current Web contains no lists."
    End If

End Sub

Community Additions