Display all items in outlook 2003 folder

G

Gmspences10

Hi VBA Friends,

I am trying in VBA to select an already created folder "createdFolder"
which has mail items in it.

What I want to do is reference the "createdFolder" and display all the
mail items contained within it, using a for each or a do until

There are numerous posts which I have been looking at and I think what
I need to do is reference the "createdFolder" using GetNamespace
method?

Can anyone help please??

Many thanks

Scott Spence
 
E

Eric Legault [MVP - Outlook]

If you know the location of the folder, you can access it fairly easily in
reference to a default folder:

Set myFolder = objInbox.Folders("MY SUBFOLDER")

Use the NameSpace.GetDefaultFolder method to return various default folders.

If you don't know the location, one way is to iterate through all of the
folders:

http://www.outlookcode.com/codedetail.aspx?id=1639

You can display a specific folder using the Explorer.CurrentFolder property
or the Explorer.SelectFolder method. You don't need to loop through
individual items in a folder to display it - they'll all display
automatically based on the last selected (or the default) View.
 
G

Gmspences10

Hi Eric,

Thanks for getting back to me, I am really struggling with qualifying
the objects.

I know what the folder name is, I found a really useful piece of code
that moves all the items from the drafts folder to an outbox subfolder
that creates the subfolder if it is not detected and moves all the
draft items into it.

The thing is that I want to open/display all the items that have been
moved to this folder.

Can you tell me what "myFolder" and "objInbox" have been defined in
memory as?
 
G

Gmspences10

Hi Eric,

Thanks for getting back to me, I am really struggling with qualifying
the objects.

I know what the folder name is, I found a really useful piece of code
that moves all the items from the drafts folder to an outbox subfolder
that creates the subfolder if it is not detected and moves all the
draft items into it.

The thing is that I want to open/display all the items that have been
moved to this folder.

Can you tell me what "myFolder" and "objInbox" have been defined in
memory as?

Scott
 
E

Eric Legault [MVP - Outlook]

Those variables are declared as Outlook.MAPIFolder objects. Always make sure
you check the Outlook VBA help file - it's full of helpful code samples.
 
Top