Reference a Folder

To reference a folder by the name of the folder, use the following code.

Application.GetNameSpace("MAPI").Folders("Personal Folders").Folders("Product Ideas")

To reference a folder by a number, use the following code. In this example, the first folder in the folder collection Personal Folders is referenced.

Application.GetNameSpace("MAPI").Folders("Personal Folders").Folders(1)

To reference any of the default Outlook folders, use the GetDefaultFolder method. Use the appropriate constant value from the OlDefaultFolders Enumeration to specify the folder you want to create.

Application.GetNameSpace("MAPI").GetDefaultFolder(6)

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.