How to add user to an existing Distribution List using Outlook VBA

  • Thread starter Thread starter INZMAM UL HAQ
  • Start date Start date
I

INZMAM UL HAQ

Guest
Hi Team,


i am new to VBA and trying to add a user to an existing distribution list. I have searched for solution but got nothing helpful

For example- i have a distribution list named "testdl@domain.com" and i need to add a user named user called "User1". I have written below code after this i do not have any idea what to do next to find the testdl@domain.com DL. However, i know that i can use "myDistList.AddMember" to add user. Please help me find the solution


Sub DisplayYourDLNames()

Dim myNameSpace As Outlook.NameSpace

Dim myFolder As Outlook.Folder

Dim myDistList As Outlook.DistListItem

Dim myFolderItems As Outlook.Items
Dim DLName As String


Set myNameSpace = Application.GetNamespace("MAPI")

Set myFolder = myNameSpace.GetDefaultFolder(olFolderContacts)

End Sub

Continue reading...
 
Back
Top