首页 文章

outlook vba跳转到收藏夹的实际文件夹

提问于
浏览
0

有没有办法(在VBA中)

(1)从Outlook收藏夹窗格中的文件夹跳转到树窗格中的实际文件夹

(2)有没有办法确定“selected”文件夹是在树中还是在收藏夹窗格中?

1 回答

  • 0

    1)通过所有公共文件夹递归搜索文件夹名称 .

    2)ActiveExplorer.CurrentFolder.FolderPath获取路径 . 使用InStr查找“收藏夹”或“所有公共文件夹” .

    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
    

相关问题