I am trying to create an Outlook distribution group from a list of emails in Excel. All the examples I have found use this line to set the distrolist name:
objDistList.DLName = "Whatever"
However, it is throwing a Run-time error 438 "Object doesn't support this property or method"
Suggestions?
objDistList.DLName = "Whatever"
However, it is throwing a Run-time error 438 "Object doesn't support this property or method"
Suggestions?
Code:
Public Sub DistributionList()
Dim objOutlook As Object
Dim objNameSpace As Object
Dim objDistList As Object
Dim objMail As Object
Dim objRecipients As Object
Set objOutlook = CreateObject("Outlook.Application")
Set objNameSpace = objOutlook.GetNamespace("MAPI")
Set objDistList = objOutlook.CreateItem(olDistributionListItem)
Set objMail = objOutlook.CreateItem(olMailItem)
Set objRecipients = objMail.Recipients
objDistList.DLName = "Whatever"