Consulting

Results 1 to 2 of 2

Thread: Outlook: Access root level custom folders

  1. #1

    Lightbulb Outlook: Access root level custom folders

    Hi, I created an Outlook folder at root level (Same level as Inbox, not inside inbox) and I am having difficulty accessing it via VBA.

    If it were inside Inbox, then the folder can be reached via

    Dim demoFolder As Outlook.Folder
    Set demoFolder = objNamespace.GetDefaultFolder(olFolderInbox).Folders("Demo")
    But if I place the folder one level up, this code does Not work...

    Dim demoFolder As Outlook.Folder
    Set demoFolder = objNamespace.Folders("Demo")
    I get error Object cannot be found

    How do I access a root level Outlook folder via VBA?

  2. #2
    The following should work
    Set demoFolder = objNamespace.GetDefaultFolder(olFolderInbox).Parent.folders("Demo")
    Graham Mayor - MS MVP (Word) 2002-2019
    Visit my web site for more programming tips and ready made processes
    http://www.gmayor.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •