View Single Post
  #3  
Old July 10th 09, 02:48 PM posted to microsoft.public.outlook.program_vba
Alan Moseley
external usenet poster
 
Posts: 61
Default Folders & Subfolders

You need to write a sub or function that is recursively called by itself.
For example:-

Public Sub ProcessAllFolders()
Dim fld As MAPIFolder
For Each fld In Application.GetNamespace("MAPI").Folders
Call ProcessFolder(fld)
Next fld
End Sub

Public Sub ProcessFolder(ByRef fld As MAPIFolder)
Dim subfld As MAPIFolder
'Do Something here
For Each subfld In fld.Folders
Call ProcessFolder(subfld)
Next subfld
End Sub

--
Alan Moseley IT Consultancy
http://www.amitc.co.uk

If I have solved your problem, please click Yes below. Thanks.


"Marvin Buzz" wrote:

I am writing in Visual Basic, not VBA. I can write the code to identify all
of the subfolders in Outlook, but do not know how to program for the
subfolders of the subfolders...subfolders to any possible depth of subfolders.

Any samples or guidance would be very much appreciated.

Thanks in advance.

Ads