Solved

VBA: How to create a personal folder in Outlook using VBA

Posted on 2006-07-12
1
807 Views
Last Modified: 2008-03-10
Hi,

I have to create a personal folder using VBA.  Any idea how can I acheive the same programmatically ?

I don't need the manual methods as I am also aware of the same.

Please let me know some script/code for creating a personal folder. Any appropriate link is also sufficient.

Regards,
Vikas.
0
Comment
Question by:TiwariVikas
1 Comment
 
LVL 76

Accepted Solution

by:
David Lee earned 500 total points
ID: 17095041
Greetings, TiwariVikas.

Use the AddStore method of the NameSpace object.  Here's a function I wrote for another question that creates an archive (PST) file for a given year.  I've added comments to help make sense of it.

Sub CreateYearlyPST(strYear As String, strArchiveFileName As String)
    Dim olkNS As Outlook.NameSpace, _
        olkFolder As Outlook.MAPIFolder
    'Create a NameSpace object
    Set olkNS = Application.GetNamespace("MAPI")
    'Create the new PST file using the name passed
    olkNS.AddStore strArchiveFileName
    'Get the root folder in the new PST file.  OpenMAPIFolder is a custom function.  I can post the code if you need.
    Set olkFolder = OpenMAPIFolder("\Personal Folders")
    'Create a fodler called Inbox
    olkFolder.Folders.Add "Inbox", olFolderInbox
    olkFolder.Name = strYear
    olkNS.RemoveStore olkFolder
    Set olkFolder = Nothing
    Set olkNS = Nothing
End Sub

Cheers!
0

Featured Post

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This process describes the steps required to Import and Export data from and to .pst files using Exchange 2010. We can use these steps to export data from a user to a .pst file, import data back to the same or a different user, or even import data t…
This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

948 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now