多个对象![]() ![]() ![]() |
包含关于 List 对象和 Microsoft FrontPage 协作对象的信息。List 对象是一个基类,定义了 FrontPage 中不同类型列表所用的公用成员。例如,协作对象(BasicList、DocumentLibrary 和 Survey 对象)允许在不同用户和不同站点之间共享和交换信息。List 对象是 Lists 集合的成员。
使用 Lists.Item(index) 返回单个 List 对象,其中 index 是列表的名称或其在集合中的位置(用数字表示)。下列示例显示活动站点所有列表的名称。如果站点不包含列表,则向用户显示一条消息。
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