Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Outlook macro - need to specify a folder 1

Status
Not open for further replies.

Rocroc

Technical User
Sep 3, 2001
8
0
0
GB
Hi - writing a macro in Outlook (I know that this is not true VBS, but someone must know the answer!). I use the following code to select a folder AAA UNDER the inbox:

Set objApp = CreateObject("Outlook.Application")
Set MyNameSpace = objApp.GetNameSpace("MAPI")
Set MyFolder = MyNameSpace.GetDefaultFolder(olFolderInbox)
Set MyNewFolder = MyFolder.Folders("AAA")
Set objSelection = objApp.ActiveExplorer.Selection

I need to specify a (non-default) folder AAA which is alongside the Inbox, not beneath it - how do I do this?




 
If the folder is at the same level as the Inbox, use:

Set MyFolder = MyNameSpace.GetDefaultFolder(olFolderInbox)
Set MyNewFolder = MyFolder.Parent.Folders("AAA") Jon Hawkins
 
Thaks Jon - precisely what I needed - very much appreciated.

Roc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top