Add to Distribution List doesn't work

  • Thread starter Thread starter John Birtwistle
  • Start date Start date
J

John Birtwistle

The code below should add the contact Jeff Smith
(who exists and has a valid email address) to
the distribution list DList.
The list is created but Jeff Smith is not added to it.
Any ideas why code doesn't work ?
No problem doing it manually.

'VB6 and Outlook 2002
Dim olApp As Outlook.Application
Dim olNamespace As Outlook.NameSpace
Dim objMail As Outlook.MailItem
Dim objRcpnt As Outlook.Recipient
Dim objitem As Outlook.DistListItem

Set olApp = New Outlook.Application
Set olNamespace = olApp.GetNamespace("MAPI")

Set objMail = olApp.CreateItem(olMailItem)

Set objRcpnt = objMail.Recipients.Add("Jeff Smith")
Set objitem = olApp.CreateItem(olDistributionListItem)

objitem.AddMember Recipient:=objRcpnt
objitem.DLName = "DList"
objitem.Save

John Birtwistle
 
Back
Top