'A list of all the folders contained in the namespace:
Sub List_All_NameSpace_Folders()
Dim myNS As NameSpace
Dim myFolder As MAPIFolder
Dim mySubfolder As MAPIFolder
strFolderList = "Your Outlook NameSpace contains these folders:"
Set myNS = Application.GetNamespace("MAPI")
With myNS
For Each myFolder In myNS.Folders
strFolderList = strFolderList & myFolder.Name & vbCr
For Each mySubfolder In myFolder.Folders
Debug.Print mySubfolder.Name
Next mySubfolder
Next myFolder
End With
End Sub
|