WebEx![]() ![]() ![]() |
Represents the collection of all List objects in the current web. Lists allow information to be shared and exchanged between different users and different webs.
Use the Lists property of the WebEx object to return the collection of all lists in the web. Use Lists.item(index), where index is the either name of the list or its numeric position within the collection to return a single List object.
The following example displays the names of all lists in the active web. If the active web does not contain any lists, a message is displayed to the user.
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
'Other wise display message to user
MsgBox "The current web contains no lists."
End If
End Sub
Use the Lists.Add method to add a new list to the Lists collection. The following example adds a new list of type fpBasicList called NewShare to the active web.
Sub NewList()
'Adds a new list to the current web
Dim objApp As FrontPage.Application
Dim objLists As Lists
Set objApp = FrontPage.Application
Set objLists = objApp.ActiveWeb.Lists
'Add new list
objLists.Add Name:="NewShare", _
ListType:=fpListTypeBasicList, _
Description:="List of Shared files"
'Display message to user
MsgBox "A new list was added to the Lists collection."
End Sub