LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel.misc
external usenet poster
 
Posts: 284
Default Create Outlook Distribution lists in Excel VBA

Below is the example from VBA help that shows how to add members. I don't
find it intuitive but it is the way it is.

Sub AddNewMembers()
Dim myOlApp As New Outlook.Application
Dim myNameSpace As Outlook.NameSpace
Dim myDistList As Outlook.DistListItem
Dim myTempItem As Outlook.MailItem
Dim myRecipients As Outlook.Recipients
Set myNameSpace = myOlApp.GetNamespace("MAPI")
Set myDistList = myOlApp.CreateItem(olDistributionListItem)
Set myTempItem = myOlApp.CreateItem(olMailItem)
Set myRecipients = myTempItem.Recipients
myDistList.DLName = _
InputBox("Enter the name of the new distribution list")
myRecipients.Add myNameSpace.CurrentUser.Name
myRecipients.Add "Dan Wilson"
myRecipients.ResolveAll
myDistList.AddMembers myRecipients
myDistList.Save
myDistList.Display
End Sub


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I easily create an Outlook distribution list from excel? Lisa Excel Discussion (Misc queries) 1 June 13th 08 04:25 PM
can i create a distribution list between excel and outlook? distribution list Excel Discussion (Misc queries) 8 May 6th 08 04:59 PM
Create Outlook Distribution lists in Excel VBA [email protected] Excel Discussion (Misc queries) 3 October 8th 07 06:51 PM
Create Outlook Distribution lists (default txt file) with excel nicolascap Excel Programming 5 March 3rd 06 04:36 PM
How do I create an Outlook distribution list from an Excel column Mike Officer Excel Discussion (Misc queries) 2 June 24th 05 04:45 AM


All times are GMT +1. The time now is 02:59 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"