StartDownloadsServiceSamplesWorkshopsContact DeutschEnglish
 
Samples
General
Outlook®
 
Awarded by
Microsoft since 2005:
mvp logo
VBOffice Info
Visitors1853424
Impressions6967222
Links
Imprint
Privacy Policy
Contact
Distribution List: Create nested collections
Author: Michael BauerHomepage
Date: 08.01.2008Accessed: 22321
  
Description

You cannot add a distribution list directly to another one but must use Recipients objects. 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 to a second distribution list.

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
 
 

ReplyAll alerts you before unintentionally replying all, or if you are a confidential BCC recipient of the ... [more]

 

Access the master category list in the blink of an eye, share your categories in a network, get a reminder service, and ... [more]

 

SAM automatically sets the sender, signature, and folder for sent items, for instance based on the recipient ... [more]

 

OLKeeper reliably prevents users from closing their Outlook window and thus possibly missing reminders or ... [more]