FrontPage VBA教程:DocumentLibrary对象



使用 DocumentLibrary对象

使用 Lists.Item(index) 可以返回单个 DocumentLibrary对象,其中 index 是文档库的名称或其在集合中的位置(用数字表示)。下列示例显示活动站点中所有文档库的名称。如果站点不包含文档库,则向用户显示一条消息。

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 and is 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
                    strName = strName & lstWebList.Name & vbCr
                End If
            End If
        If blnFound = True Then
            'Display names of all document libraries
            MsgBox "The names of all document libraries in the current web are:" _
                   & vbCr & strName
            MsgBox "There are no document libraries in the current web."
        End If
        'Otherwise display message to user
        MsgBox "The current web contains no lists."
    End If
End Sub

使用 List对象的Add方法可以创建 fpListTypeDocumentLibrary 类型的新列表。下列示例创建名为 Newlibrary 的新文档库。

Sub NewLibrary()
'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:="NewLibrary", _
                 ListType:=fpListTypeDocumentLibrary, _
                 Description:="List of Shared files"
    'Display message to user
    MsgBox "A new library was added to the Lists collection."
End Sub

上页:FrontPage VBA教程:DispFPHTMLDocument对象 下页:FrontPage VBA教程:IFPDocument对象

FrontPage VBA教程:DocumentLibrary对象

FrontPage VBA教程:IFPDocument对象 FrontPage VBA教程:IHTMLFrontPageBotElement对象
FrontPage VBA教程:List对象 FrontPage VBA教程:ListField对象
FrontPage VBA教程:ListFieldChoice对象 FrontPage VBA教程:ListFieldComputed对象
FrontPage VBA教程:ListFieldCounter对象 FrontPage VBA教程:ListFieldCurrency对象
FrontPage VBA教程:ListFieldDateTime对象 FrontPage VBA教程:ListFieldFile对象
FrontPage VBA教程:ListFieldInteger对象 FrontPage VBA教程:ListFieldLookup对象
FrontPage VBA教程:ListFieldMultiLine对象 FrontPage VBA教程:ListFieldNumber对象
FrontPage VBA教程:ListFields集合 FrontPage VBA教程:ListFieldSingleLine对象
FrontPage VBA教程:ListFieldTrueFalse对象 FrontPage VBA教程:ListFieldURL对象
FrontPage VBA教程:Lists集合 FrontPage VBA教程:MetaTags集合对象
版权所有 © 中山市飞娥软件工作室 证书:粤ICP备09170368号