Search Outlook Folder recursively

Category:
Office/VBA
Type:
Snippets
Difficulty:
Intermediate
Author:
Brian

Version Compatibility: Visual Basic 6, Visual Basic 5

More information:
This snippet allows you to search for an Outlook folder within a parent folder. Sample Usage:
Dim oMAPI As Outlook.NameSpace
Dim oParentFolder As Outlook.MAPIFolder
Dim objFolder As Outlook.MAPIFolder
    
Set oMAPI = GetObject _
   ("", "Outlook.application").GetNamespace("MAPI")
Set oParentFolder = oMAPI.Folders("Public Folders")

Set objFolder = OutlookFolderNames _
  (oParentFolder, "anyfoldername")

Instructions: Copy the declarations and code below and paste directly into your VB project.

Declarations:

Code: