1. Here's a thread that needs an answer: Attachment Save for Exchange

How To Refer To Custom Folder in VBA

Discussion in 'Outlook VBA and Custom Forms' started by Rich Locus, May 8, 2010.

  1. Rich Locus

    Rich Locus

    Guest
    Hello Outlook Group:

    I am trying to reference a CUSTOM user folder at the same level as all the

    other folders:

    For example, I have a folder called MyEmails that appears in the Outlook

    tree as follows:

    Calendar

    Contacts

    Deleted Items

    Drafts

    Inbox

    MyEmails

    The VBA code I'm using from Access works for the Inbox, but fails on the

    MAPI setup of the MyEmails Folder:

    Set Inbox = OlApp.GetNamespace("Mapi").GetDefaultFolder(olFolderInbox)

    Set MyEmailFolder = OlApp.GetNamespace("Mapi").Folders("MyEmail")

    I don't want to the the GetDefaultFolder because it isn't one. Does anyone

    know the code to create the Namespace for "MyEmail"?

    Thanks,

    Rich Locus

    Rich Locus

    Logicwurks, LLC
  2. Rich Locus

    Rich Locus

    Guest
    I finally came up with the code to do this... I had to refer to the Parent

    directory of the Inbox:

    Set MyEmailFolder =

    OlApp.GetNamespace("Mapi").GetDefaultFolder(olFolderInbox).Parent.Folders("MyEmail")

    Rich Locus

    Logicwurks, LLC

    "Rich Locus" wrote:


    > Hello Outlook Group:

    > I am trying to reference a CUSTOM user folder at the same level as all the
    > other folders:

    > For example, I have a folder called MyEmails that appears in the Outlook
    > tree as follows:

    > Calendar
    > Contacts
    > Deleted Items
    > Drafts
    > Inbox
    > MyEmails

    > The VBA code I'm using from Access works for the Inbox, but fails on the
    > MAPI setup of the MyEmails Folder:

    > Set Inbox = OlApp.GetNamespace("Mapi").GetDefaultFolder(olFolderInbox)
    > Set MyEmailFolder = OlApp.GetNamespace("Mapi").Folders("MyEmail")

    > I don't want to the the GetDefaultFolder because it isn't one. Does anyone
    > know the code to create the Namespace for "MyEmail"?

    > Thanks,
    > Rich Locus

    > > Rich Locus
    > Logicwurks, LLC
Similar Threads
Forum Title Date
Exchange Server Questions VB Referring to a custom contacts folder Mar 26, 2013
Using Outlook mail preferences in custom folders May 11, 2010
BCM (Business Contact Manager) How best to track OUTGOING referrals? Jun 16, 2014
Using Outlook Outlook Crash on referencing forms May 1, 2014
Using Outlook multiple instance search preferences Aug 20, 2012

Share This Page