PDA

View Full Version : Get Items from Subfolder



chris111
02-23-2012, 08:57 AM
I'm trying to adapt this code from another macro, but can't figure out how to reference the subfolder correctly. I am new to vba for outlook.

I want the items from "Inbox/Downloads/Positions" folder..

my code is:


Set ns = Application.GetNamespace("MAPI")
Set DownloadItems = ns.Folders.Item("Personal Folders").Folders.Item("Downloads").Items

i am breaking on line 2..

thanks

JP2112
02-23-2012, 02:17 PM
Try this:

Set DownloadItems = ns.Folders("Personal Folders").Folders("Inbox").Folders("Downloads").Folders("Positions").Items