
getting distribution list from Contacts
Joe,
here's an example I wrote yesterday in Access:
Sub EmailResults(Result As Boolean)
Dim objApp As Object
Dim objMail As Object
Dim strRecipient1 As String
Dim strBody As String
Dim strSubject As String
Set objApp = CreateObject("outlook.application")
Set objMail = objApp.CreateItem(0)
strRecipient1 = "IM2" 'Name of distribution list
If Result Then
strSubject = "IM2 Data Processing Succeeded"
strBody = "The batch finished processing at " & Now()
Else
strSubject = "IM2 Data Processing Failed"
strBody = "The batch finished processing at " & Now()
End If
With objMail
.Subject = strSubject
.Recipients.Add strRecipient1
.Body = strBody
.Send
End With
Set objApp = Nothing
Set objMail = Nothing
End Sub
Kevin
Quote:
>-----Original Message-----
>I am automating Outlook from XL and would like to set a
>code reference to a distribution list that is kept in the
>Contacts collection.
>Would someone please help me with the syntax or point me
>to a site where I can find an example of valid code to do
>this? Once I have the list reference, I believe that I
>can take it from there.
>Also, is there a way to determine with the code whether
>the Distribution List is kept with the Contacts or the
>Address book?
>Thanks,
>Joe
>.