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.
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm
"Humphrey" <Humphrey DeleteThis @discussions.microsoft.com> wrote in message
news:0679E166-BA7E-4E08-8D60-E053DEBDF2BC@microsoft.com...
> 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