Search code examples
vbaoutlookoutlook-2010

Creating folders in Outlook 2010


I have a folder containing many subfolders on my desktop that I need to recreate in outlook 2010. The folders are empty and I have it as a template. There is something like 400 folders so I am trying to avoid manually creating every one of them in outlook.

The issue I have is that these folders aren't being put under my inbox, they are going to be created under a common mailbox accessible by my coworkers. We are using this for archiving purposes. Most of the codes I have found are for creating folders under your inbox.

How would I go about recreating the directory under this public mailbox? I have very little experience in VBA programming. I also have all the folder names in excel if that makes it any easier to accomplish this.

Thanks in advance for any help.


Solution

  • Well, I'd suggest starting from the Getting Started with VBA in Outlook 2010 article in MSDN to learn the basics. From the Outlook object model there is no difference where the folder is located. The Add method of the Folders class creates a new folder in the Folders collection.

    You may use the Stores property of the Namespace class which returns a Stores collection object that represents all the Store objects in the current profile. Also the GetSharedDefaultFolder method of the Namespace class returns a Folder object that represents the specified default folder for the specified user.