-
referencing a sub folder
I understand how to reference the currently selected folder using:
[VBA]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
[/VBA]
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?
-Once my PC stopped working, so I kicked it......Then it started working again
-
The MAPIFolder class has a Folders class which is named Folders, which is basically just a collection of the folders' subfolders.
Fox example:
[VBA]Dim myFolder as MAPIFolder
set myFolder = ...
Dim CurrSubFolder as MAPIFolder
For each CurrSubFolder in myFolder
' Do whatever
Next CurrSubFolder[/VBA]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules