IsRootFolder 属性
如果指定的文件夹是根文件夹,则返回 True;否则返回 False。
语法
对象。IsRootFolder
对象始终是 Folder 对象。
备注
以下代码演示如何使用 IsRootFolder 属性。
Dim fs
Set fs = CreateObject("Scripting.FileSystemObject")
Sub DisplayLevelDepth(pathspec)
Dim f, n
Set f = fs.GetFolder(pathspec)
If f.IsRootFolder Then
MsgBox "The specified folder is the root folder."
Else
Do Until f.IsRootFolder
Set f = f.ParentFolder
n = n + 1
Loop
MsgBox "The specified folder is nested " & n & " levels deep."
End If
End Sub
另请参阅
支持和反馈
有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈