Option Explicit
Private Sub FavoritesOrTree()
Dim startFolder As Folder
Dim parentFolder As Folder
Dim path As String
Set startFolder = ActiveExplorer.CurrentFolder
Debug.Print startFolder
path = startFolder.FolderPath
Debug.Print "Path: " & path
If InStr(path, "Favorites") Then
Debug.Print "Favorites"
ElseIf InStr(path, "All Public Folders") Then
Debug.Print "Tree"
Else
Debug.Print "Not in a public folder?"
End If
End Sub
1 回答
1)通过所有公共文件夹递归搜索文件夹名称 .
2)ActiveExplorer.CurrentFolder.FolderPath获取路径 . 使用InStr查找“收藏夹”或“所有公共文件夹” .