Hi
If anyone could help me with this it would be much appreciated.
I have the following macro
Public Sub DistributionList()
Dim objOutlook As New Outlook.Application
Dim objNameSpace As Outlook.Namespace
Dim objDistList As Outlook.DistListItem
Dim objMail As Outlook.MailItem
Dim objRecipients As Outlook.Recipients
Set objNameSpace = objOutlook.GetNamespace("MAPI")
Set objDistList = objOutlook.CreateItem(olDistributionListItem)
Set objMail = objOutlook.CreateItem(olMailItem)
Set objRecipients = objMail.Recipients
objDistList.DLName = InputBox("Enter name of Distribution List")
For i = 1 To Cells(ActiveSheet.Rows.Count, 1).End(xlUp).Row
objRecipients.Add (Range("C" & i).Value)
Next i
objDistList.AddMembers objRecipients
objDistList.Display
objRecipients.ResolveAll
Set objOutlook = Nothing
Set objNameSpace = Nothing
Set objDistList = Nothing
Set objMail = Nothing
Set objRecipients = Nothing
End Sub
which takes email addresses from Column 'C' in a spreadsheet and puts them into a distribution list in Outlook. When they are put in the the distribution list the name field and email address field are both populated with the email address.
Would it be possible to take the details of Column 'B' from the spreadsheet - which are customer names - and put in the 'name' column of the distribution list and have the email address showing only in the email address field.
Hopefully
Deb
If anyone could help me with this it would be much appreciated.
I have the following macro
Public Sub DistributionList()
Dim objOutlook As New Outlook.Application
Dim objNameSpace As Outlook.Namespace
Dim objDistList As Outlook.DistListItem
Dim objMail As Outlook.MailItem
Dim objRecipients As Outlook.Recipients
Set objNameSpace = objOutlook.GetNamespace("MAPI")
Set objDistList = objOutlook.CreateItem(olDistributionListItem)
Set objMail = objOutlook.CreateItem(olMailItem)
Set objRecipients = objMail.Recipients
objDistList.DLName = InputBox("Enter name of Distribution List")
For i = 1 To Cells(ActiveSheet.Rows.Count, 1).End(xlUp).Row
objRecipients.Add (Range("C" & i).Value)
Next i
objDistList.AddMembers objRecipients
objDistList.Display
objRecipients.ResolveAll
Set objOutlook = Nothing
Set objNameSpace = Nothing
Set objDistList = Nothing
Set objMail = Nothing
Set objRecipients = Nothing
End Sub
which takes email addresses from Column 'C' in a spreadsheet and puts them into a distribution list in Outlook. When they are put in the the distribution list the name field and email address field are both populated with the email address.
Would it be possible to take the details of Column 'B' from the spreadsheet - which are customer names - and put in the 'name' column of the distribution list and have the email address showing only in the email address field.
Hopefully
Deb