Represents the collection of documents in the current Web site.
Remarks
Use Lists(Index), where Index is either the name of the document library or its numeric position within the collection, to return a single DocumentLibrary object. The following example displays the names of all document libraries in the active Web site. If the Web site contains no document libraries, a message is displayed to the user.
Visual Basic for Applications
Sub ListAllLibraries()
'Displays the names of all document libraries
'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; if so, cycle through them
If Not ActiveWeb.Lists Is Nothing Then
For Each lstWebList In ActiveWeb.Lists
If lstWebList.Type = fpListTypeDocumentLibrary Then
'Set boolean flag to found and add name to string
blnFound = True
If strName = "" Then
strName = lstWebList.Name & vbCr
Else
strName = strName & lstWebList.Name & vbCr
End If
End If
Next
If blnFound = True Then
'Display names of all document libraries
MsgBox "The names of all document libraries in the current web site are:" _
& vbCr & strName
Else
MsgBox "There are no document libraries in the current web site."
End If
Else
'Otherwise display message to user
MsgBox "The current web contains no lists."
End If
End Sub