OTWarrior
02-06-2009, 05:08 AM
I understand how to reference the currently selected folder using:
Function DisplayCurrentFolderName()
Dim myOlApp As Outlook.Application
Dim myExplorer As Outlook.Explorer
Dim myFolder As Outlook.MAPIFolder
Set myOlApp = CreateObject("Outlook.Application")
Set myExplorer = myOlApp.ActiveExplorer
Set myFolder = myExplorer.CurrentFolder
DisplayCurrentFolderName = myFolder.Name
End Function
This will display the name of the folder or sub folder that is selected, however I am unsure how to reference a sub folder without selecting it and running this function.
I know you can loop through the default parent folders (inbox, outbox), but how do you do this with subfolders?
Function DisplayCurrentFolderName()
Dim myOlApp As Outlook.Application
Dim myExplorer As Outlook.Explorer
Dim myFolder As Outlook.MAPIFolder
Set myOlApp = CreateObject("Outlook.Application")
Set myExplorer = myOlApp.ActiveExplorer
Set myFolder = myExplorer.CurrentFolder
DisplayCurrentFolderName = myFolder.Name
End Function
This will display the name of the folder or sub folder that is selected, however I am unsure how to reference a sub folder without selecting it and running this function.
I know you can loop through the default parent folders (inbox, outbox), but how do you do this with subfolders?