Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Feb 2001
    Location
    Auckland, North Island, New Zealand
    Posts
    83
    Thanks
    0
    Thanked 0 Times in 0 Posts

    selecting sub folders in VBA

    I have a folder called "general" this contains 20 subfolders ("economist", "news",...)some of these subfolders also contain subfolders ("economist" contains "world" and "business").So in DOS, path would be generaleconomistworld

    How do I repeat this in VBA?

    So far in outlook VBA I have

    Set mynamespace = myolapp.GetNamespace("MAPI")
    Set myfolder = mynamespace.Folders("general")
    set myfolder = myfolder.folders(x)

    where x is "economist" -this works fine

    How can I get x ="world" or "economist" and work in both cases? (in dos x= economistworld or economist)

  2. #2
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Roanoke area, Virginia, USA
    Posts
    3,729
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: selecting sub folders in VBA

    you need to drill down one more level:

    Set mynamespace = myolapp.GetNamespace("MAPI")
    Set myfolder = mynamespace.Folders("general")
    set myfolder = myfolder.folders("economist")
    set myfolder = myfolder.folders("world")

    should equal a path of generaleconomistworld

    see http://www.slipstick.com

  3. #3
    Star Lounger
    Join Date
    Feb 2001
    Location
    Auckland, North Island, New Zealand
    Posts
    83
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: selecting sub folders in VBA

    Thanks MJ for the quick response, but my question wasn't that easy....

    I was really after a way of defining the next folder level from the parent level ie:
    Set mynamespace = myolapp.GetNamespace("MAPI")
    Set myfolder = mynamespace.Folders("general")
    set myfolder = myfolder.folders("economist.world")

    so that I can refer to the items in either economist or world in the remaining code as myfolder.items
    eg

    for i = 1 to myfolder.items.count
    blah blah
    next i

    Thanks again

Posting Permissions

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