Office VBA教程:ScopeFolders属性

返回ScopeFolders集合。该集合中的项对应于父 ScopeFolder对象的子文件夹。

expression.ScopeFolders

expression   必需。该表达式返回“应用于”列表中的对象之一。

VBA示例

本示例显示“我的电脑”中每个目录的根路径。为了检索该信息,本示例首先获得“我的电脑”根目录下的 ScopeFolder对象。该 ScopeFolder 的路径将总是 "*"。对于所有 ScopeFolder对象,根对象包含一个 ScopeFolders集合。本示例在该 ScopeFolders集合中循环,并显示其中每个 ScopeFolder对象的路径。这些 ScopeFolder对象的路径将为 "A:\"、"C:\" 等等。


Sub DisplayRootScopeFolders()
    'Declare variables that reference a
    'SearchScope and a ScopeFolder object.
    Dim ss As SearchScope
    Dim sf As ScopeFolder
    'Use a With...End With block to reference the
    'FileSearch object.
    With Application.FileSearch
        'Loop through the SearchScopes collection
        'and display all of the root ScopeFolders collections in
        'the My Computer scope.
        For Each ss In .SearchScopes
            Select Case ss.Type
                Case msoSearchInMyComputer
                    'Loop through each ScopeFolder object in
                    'the ScopeFolders collection of the
                    'SearchScope object and display the path.
                    For Each sf In ss.ScopeFolder.ScopeFolders
                        MsgBox "Path: " & sf.Path
                    Next sf
                Case Else
            End Select
        Nextb ss
    End With
End Sub

上页:Office VBA教程:ScopeFolder属性 下页:Office VBA教程:ScriptText属性

Office VBA教程:ScopeFolders属性

Office VBA教程:ScriptText属性 Office VBA教程:SearchFolders属性
Office VBA教程:SearchScopes属性 Office VBA教程:SearchSubFolders属性
Office VBA教程:SearchWhenProgramming属性 Office VBA教程:SecondValue属性
Office VBA教程:SelectedItems属性 Office VBA教程:Shape属性
Office VBA教程:ShortcutText属性 Office VBA教程:SignDate属性
Office VBA教程:Signer属性 Office VBA教程:Sounds属性
Office VBA教程:State属性 Office VBA教程:Style属性
Office VBA教程:Table属性 Office VBA教程:Tag属性
Office VBA教程:Text属性 Office VBA教程:TextOrProperty属性
Office VBA教程:TipOfDay属性 Office VBA教程:Title属性
版权所有 © 中山市飞娥软件工作室 证书:粤ICP备09170368号