ScopeFolder.Path 属性 (Office)
获取一个 String 类型的值,该值指示 ScopeFolder 对象的完整路径。 此为只读属性。
语法
表达式。路径
表达 一个代表 ScopeFolder 对象的变量。
示例
以下示例显示“我的计算机”中每个目录的根路径。 为了检索此信息,该示例首先获取“我的计算机”根目录中的 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
'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 collections 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
Next ss
End Sub
另请参阅
支持和反馈
有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈