I am trying to send one email to group of people in .CC
.
I have one Excel worksheet called "Project" with drop down list which contains contact group names.
Workers 1 shift (address B2), on the other worksheet called "contacts" I have email list in columns with first row of name of above groups (headline address A2:AX2).
I want to choose from the drop down list the email group and send one email to each person on the list. Now I have an Inputbox with range that I have to select manually.
Sub EmailCC()
Dim xOTApp As Object
Dim xMItem As Object
Dim xCell As Range
Dim xRg As Range
Dim xEmailAddr As String
Dim xTxt As String
On Error Resume Next
xTxt = ActiveWindow.RangeSelection.Address
Set xRg = Application.InputBox("Address list:", "Range", xTxt, , , , , 8)
If xRg Is Nothing Then Exit Sub
Set xOTApp = CreateObject("Outlook.Application")
For Each xCell In xRg
If xCell.Value Like "*@*" Then
If xEmailAddr = "" Then
xEmailAddr = xCell.Value
Else
xEmailAddr = xEmailAddr & ";" & xCell.Value
End If
End If
Next
Set xMItem = xOTApp.CreateItem(0)
With xMItem
.To = " "
.CC = xEmailAddr
.Display
End With
End Sub