access folder\subfolder outlook RRS feed

  • Question


    I use this code to access all the mails in a subfolder of the inbox, and it works ok

       Set ns = GetNamespace("MAPI")
        Set Inbox = ns.GetDefaultFolder(olFolderInbox)
        Set SubFolder = Inbox.Folders(OutlookFolderInInbox)

    but I want to access a subfolder from a subfolder of the inbox , so the

    OutlookFolderInInbox    is like "folder\subfolder"

    but this gives an error "object not found" although it is there and the spelling is ok

    is it possible to access a subfolder form a folder of the default inbox ? and if yes , what am I doing wrong ?

    Monday, September 5, 2016 1:09 PM


  • I think you need to use the folders collection for the subfolder again:

      Set SubFolder = Inbox.Folders("yourfolder").Folders("yoursubfolder")

    Matthias Kläy, Kläy Computing AG

    • Marked as answer by tekoko10 Monday, September 5, 2016 2:47 PM
    Monday, September 5, 2016 2:36 PM

All replies