N
NateG
Ok,
Here's my addList Function that actually works very nicely:
Private Sub addList(ByVal listName As String, ByVal memberList() As String,
ByVal memberEmails() As String)
Dim oApp As Outlook.Application
Dim oNS As Outlook.NameSpace
Dim oDL As Outlook.DistListItem
Dim i As Integer
Dim oRecipient As Outlook.Recipient
oApp = CreateObject("Outlook.Application")
oNS = oApp.GetNamespace("MAPI")
oDL = oApp.CreateItem(Outlook.OlItemType.olDistributionListItem)
oDL.DLName = listName
oDL.Save()
For i = 0 To UBound(memberEmails)
If memberList(i) = Nothing Then
Exit For
End If
oRecipient = oNS.CreateRecipient(memberList(i) & "<" &
memberEmails(i) & ">")
oRecipient.Resolve()
oDL.AddMember(oRecipient)
oDL.Save()
Next
oDL.Save()
'Clean up
oApp = Nothing
oNS = Nothing
oDL = Nothing
oRecipient = Nothing
End Sub
Let me know what I need to do to give you guys credit, like forum points or
whatever they give you guys for helping out. I'd love to return the favor.
Here's my addList Function that actually works very nicely:
Private Sub addList(ByVal listName As String, ByVal memberList() As String,
ByVal memberEmails() As String)
Dim oApp As Outlook.Application
Dim oNS As Outlook.NameSpace
Dim oDL As Outlook.DistListItem
Dim i As Integer
Dim oRecipient As Outlook.Recipient
oApp = CreateObject("Outlook.Application")
oNS = oApp.GetNamespace("MAPI")
oDL = oApp.CreateItem(Outlook.OlItemType.olDistributionListItem)
oDL.DLName = listName
oDL.Save()
For i = 0 To UBound(memberEmails)
If memberList(i) = Nothing Then
Exit For
End If
oRecipient = oNS.CreateRecipient(memberList(i) & "<" &
memberEmails(i) & ">")
oRecipient.Resolve()
oDL.AddMember(oRecipient)
oDL.Save()
Next
oDL.Save()
'Clean up
oApp = Nothing
oNS = Nothing
oDL = Nothing
oRecipient = Nothing
End Sub
Let me know what I need to do to give you guys credit, like forum points or
whatever they give you guys for helping out. I'd love to return the favor.