I have an email challenge that I have not been able to overcome. I was using Sendmail but could not add anything to the body of the email. I switched over to the method below but have not been able to figure out how to use a variable in the .To instead of an email address. The email addresses will change everytime this macro is used so that is the reason it needs to be a variable and not just an email group. Thanks for your help!!
[/B][/SIZE]
Code:
Dim vAddresses As Variant
With ActiveSheet
vAddresses = Application.Transpose(.Range("C2:C" & _
.Cells(Rows.Count, "C").End(xlUp).Row))
End With
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
If ActiveWorkbook.Path <> "" Then
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
strbody = "[SIZE=3]" & _
"All,
" & _
"Testing.
[B]"
On Error Resume Next
With OutMail
.To = vAddresses
.CC =
.BCC = ""
.Subject = "Claim Number Validation Report- " & Format(Date, "mm/dd/yy")
.HTMLBody = strbody
.Attachments.Add ("[URL="file://\\abc\client_services$\1"]\\abc\[/URL]ABC Report " & Format(Date, "yyyy.mm.dd") & ".xls")
.Display
.Send
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
Else
MsgBox "The ActiveWorkbook does not have a path, Save the file first."
End If