J
Jeff Rush
Hi All,
I have the following code and it is going horribly wrong. It is not
finding/enumerating the DL.
I could use some advice on what would be the best way to do this.
I have tried the following code and am going off track somehwere..
Any suggestions or help would be greatly appreciated.
Thx,
Jeff
CODE FOLLOWS:
----------------------------------------------------------------------------
-
Sub DLBreakout()
'Distribution List Enumeration Program.
'This Macro will do the following (1.0)
' This will read the recipients list of the current email and
' will list the members of the DL(s) in to a new email message body
' that can be sent to end users.
'
Dim MyDL As DistListItem
Dim MyRecp As Recipients
'Set variable to the (collection of) selected items in Inbox.
Set myOlSel = Application.ActiveExplorer.Selection
'Set Variable to select the default INBOX folder
Set MyFolder = Session.GetDefaultFolder(olFolderInbox)
'Set Source and Target forms
Set targetitem = MyFolder.Items.Add("ipm.note.DLList")
Set sourceitem = myOlSel(1)
Set MyRecip = sourceitem.Recipients
For x = 1 To MyRecip.Count
If MyRecip(x) = DistListItem Then
targetitem.Body.Print (MyRecip(x))
For i = 1 To MyRecip(x).Members.Count
'targetitem.Body =
MsgBox (vbCrLf & MyRecip(x).Members(i).Name)
'targetitem.Body =
MsgBox (vbCrLf & MyRecip(x).Members(i).Address)
Next
targetitem.Display
Else
MsgBox ("This ain't a DL")
targetitem.Delete
End If
Next
End Sub
I have the following code and it is going horribly wrong. It is not
finding/enumerating the DL.
I could use some advice on what would be the best way to do this.
I have tried the following code and am going off track somehwere..
Any suggestions or help would be greatly appreciated.
Thx,
Jeff
CODE FOLLOWS:
----------------------------------------------------------------------------
-
Sub DLBreakout()
'Distribution List Enumeration Program.
'This Macro will do the following (1.0)
' This will read the recipients list of the current email and
' will list the members of the DL(s) in to a new email message body
' that can be sent to end users.
'
Dim MyDL As DistListItem
Dim MyRecp As Recipients
'Set variable to the (collection of) selected items in Inbox.
Set myOlSel = Application.ActiveExplorer.Selection
'Set Variable to select the default INBOX folder
Set MyFolder = Session.GetDefaultFolder(olFolderInbox)
'Set Source and Target forms
Set targetitem = MyFolder.Items.Add("ipm.note.DLList")
Set sourceitem = myOlSel(1)
Set MyRecip = sourceitem.Recipients
For x = 1 To MyRecip.Count
If MyRecip(x) = DistListItem Then
targetitem.Body.Print (MyRecip(x))
For i = 1 To MyRecip(x).Members.Count
'targetitem.Body =
MsgBox (vbCrLf & MyRecip(x).Members(i).Name)
'targetitem.Body =
MsgBox (vbCrLf & MyRecip(x).Members(i).Address)
Next
targetitem.Display
Else
MsgBox ("This ain't a DL")
targetitem.Delete
End If
Next
End Sub