Step thru all the folders in Outlook

  • Thread starter Thread starter Humphrey
  • Start date Start date
H

Humphrey

I've written a routine to remove duplicates from a selection of MailItems.
It works fine however it needs me to open each directory, select all, and the
run the macro.

Can someone please give me some code to iterate thru the mail folders in
outlook, and then select all messages in that folder?

H
 
You cannot select items (shown as selected in a folder view) using code.
Once you have the folder references get the Items collection for that
folder. You can then iterate or search that collection (Find or Restrict) to
do what you want.

For various methods of iterating all the folders in an Outlook store search
on "iterate folders" at www.outlookcode.com and you will see code samples in
various languages.
 
Back
Top