VBOffice

Creating Nested Distribution Lists

Nested distlists allow to combine groups of contacts to another group.

Last modified: 2008/01/08 | Accessed: 49.329  | #61
◀ Previous sample Next sample ▶
Reporter Reporter
VBOffice Reporter is an easy to use tool for data analysis and reporting in Outlook. A single click, for instance, allows you to see the number of hours planned for meetings the next month.

You cannot directly add a distribution list to another one. So a detour via a MailItem is necessary: We add an existing distribution list (current folder selection in this sample) as a recipient to an e-mail. Then we can get the list back via the MailItem's Recipients collection and add that one to a second distribution list.


tip  How to add macros to Outlook
Public Sub CreateNestedDL()
  Dim DL As Outlook.DistListItem
  Dim Mail As Outlook.MailItem

  Set DL = Application.ActiveExplorer.Selection(1)

  Set Mail = Application.CreateItem(olMailItem)
  Mail.Recipients.Add DL.DLName

  If Mail.Recipients.ResolveAll Then
    Set DL = Application.CreateItem(olDistributionListItem)
    DL.AddMembers Mail.Recipients
    DL.DLName = "test item"
    DL.Save
    DL.Display
  End If
End Sub
Category-Manager Category-Manager
With Category-Manager you can group your Outlook categories, share them with other users, filter a folder by category, automatically categorize new emails, and more. You can use the Addin even for IMAP.
email  Send a message