Consulting

Results 1 to 2 of 2

Thread: referencing a sub folder

  1. #1
    VBAX Mentor OTWarrior's Avatar
    Joined
    Aug 2007
    Location
    England
    Posts
    389
    Location

    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

  2. #2
    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
  •