Help!

Step thru all the folders in Outlook

 
  

Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> Programming VBA RSS
Next:  OpenMsgStore exception  
Author Message
Humphrey
External


Since: Mar 27, 2007
Posts: 8



PostPosted: Wed Feb 25, 2009 9:43 pm    Post subject: Step thru all the folders in Outlook
Archived from groups: microsoft>public>outlook>program_vba (more info?)

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
Back to top
Ken Slovak - [MVP - Outlo
External


Since: Oct 17, 2003
Posts: 3355



PostPosted: Thu Feb 26, 2009 9:21 am    Post subject: Re: Step thru all the folders in Outlook [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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
Back to top
Display posts from previous:   
Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> Programming VBA All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum