?
Solved

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

Posted on 2006-07-12
1
Medium Priority
?
829 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 76

Accepted Solution

by:
David Lee earned 2000 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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

Large Outlook files lead to various unwanted errors and corruption issues. Furthermore, large outlook files can also make Outlook take longer to start-up, search, navigate, and shut-down. So, In this article, i will discuss a method to make your Out…
This article describes how to import Lotus Notes Contacts into Outlook 2016, 2013, 2010 and 2007 etc. with a few manual steps. You can easily export and migrate Lotus Notes contacts into Microsoft Outlook without having to use any third party tools.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Many of my clients call in with monstrous Gmail overloading issues with Outlook. A quick tip is to turn off the All Mail and Important folders from synching. Here is a quick video I made to show you how to turn off these and other folders in Gmail s…
Suggested Courses

765 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