IsRootFolder 属性 |
object 应为 Folder 对象的名称。
Function DisplayLevelDepth(pathspec) Dim fso, f, n Set fso = CreateObject("Scripting.FileSystemObject") Sub DisplayLevelDepth(pathspec) Set f = fso.GetFolder(pathspec) If f.IsRootFolder Then DisplayLevelDepth ="指定的文件夹是根文件夹。" Else Do Until f.IsRootFolder Set f = f.ParentFolder n = n + 1 Loop DisplayLevelDepth ="指定的文件夹是嵌套级为 " & n & " 的文件夹。" End If End Function