Below is the code that when I select any number contacts in a folder, I can send one email to all of them together using a email template.
But if I select a contact from different folders, it does not do it...so is there a way to change this so if I select more than one contact from different contact folders, it sends the email to both of them together. Thank much as usual!!
Public Sub SendToSelectedContacts()
Dim Selection As Selection
Dim strDynamicDL As String
Dim obj As Object
Set Selection = ActiveExplorer.Selection
For Each obj In Selection
If obj.Class = olContact Then
strDynamicDL = strDynamicDL & ";" & obj.Email1Address
Else
strDynamicDL = strDynamicDL & ";" & obj.DLName
End If
Next
Dim objMsg As mailItem
'Set objMsg = Application.CreateItem(olMailItem)
Set objMsg = Application.CreateItemFromTemplate("C:\Users\UserName\AppData\Roaming\Microsoft\Templates\E-mail Form.oft")
objMsg.To = strDynamicDL
objMsg.Display
Set objMsg = Nothing
Set obj = Nothing
End Sub
But if I select a contact from different folders, it does not do it...so is there a way to change this so if I select more than one contact from different contact folders, it sends the email to both of them together. Thank much as usual!!
Public Sub SendToSelectedContacts()
Dim Selection As Selection
Dim strDynamicDL As String
Dim obj As Object
Set Selection = ActiveExplorer.Selection
For Each obj In Selection
If obj.Class = olContact Then
strDynamicDL = strDynamicDL & ";" & obj.Email1Address
Else
strDynamicDL = strDynamicDL & ";" & obj.DLName
End If
Next
Dim objMsg As mailItem
'Set objMsg = Application.CreateItem(olMailItem)
Set objMsg = Application.CreateItemFromTemplate("C:\Users\UserName\AppData\Roaming\Microsoft\Templates\E-mail Form.oft")
objMsg.To = strDynamicDL
objMsg.Display
Set objMsg = Nothing
Set obj = Nothing
End Sub