Created
August 21, 2018 19:50
-
-
Save guinslym/d1c4d6f4568a52d25eafa1933e6f2825 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub List_All_NameSpace_Folders() | |
'https://stackoverflow.com/questions/16225353/outlook-macro-to-collect-extract-data-from-subject-field-of-numerous-messages | |
Dim myNS As NameSpace | |
Dim myFolder As MAPIFolder | |
Dim mySubfolder As MAPIFolder | |
Dim strFolderList As String | |
strFolderList = "Your Outlook NameSpace contains these folders:" _ | |
& vbCr & vbCr | |
Set myNS = Application.GetNamespace("MAPI") | |
With myNS | |
For Each myFolder In myNS.Folders | |
strFolderList = strFolderList & myFolder.Name & vbCr | |
For Each mySubfolder In myFolder.Folders | |
strFolderList = strFolderList & "* " & mySubfolder.Name & vbCr | |
Next mySubfolder | |
Next myFolder | |
End With | |
MsgBox strFolderList, vbOKOnly + vbInformation, "Folders in NameSpace" | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment