Sub ListAllLists()
'Displays the names of all lists in the collection
Dim lstWebList As List
Dim strName As String
'Check if any lists exist
If Not ActiveWeb.Lists Is Nothing Then
'Cycle through lists
For Each lstWebList In ActiveWeb.Lists
'add list names to string
If strName = "" Then
strName = lstWebList.Name & vbCr
Else
strName = strName & lstWebList.Name & vbCr
End If
Next
'Display names of all lists
MsgBox "The names of all lists in the current web are:" _
& vbCr & strName
Else
'Otherwise display message to user
MsgBox "The current web contains no lists."
End If
End Sub
Similarly, use the WebFolder object's List property to return the List object associated with the folder.
Use the List object's Fields property to return a collection of ListField objects that define the fields in the current list.