Hi
I have the following macro that works fine to send the active workbook to one recipient and one CC, with reference to two cells:
Sub Mail_Workbook() 'Excel VBA to send mail.
Dim OutApp As Object
Dim OutMail As Object
Dim str1 As String
Dim str2 As String
Dim str3 As String
Dim str4 As String
Dim str5 As String
str1 = [N3]
str2 = [N1]
str3 = [N2]
str4 = [T4]
str5 = [T5]
Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.TO = str1
.CC = str4
.Subject = str2
.Body = "Hello," & vbCrLf & vbCrLf & "Please find attached your latest statement." & vbCrLf & vbCrLf & "Please return your completed report by " & str3 & vbCrLf & vbCrLf & "Thank you" & vbCrLf & "Kind Regards,"
.Attachments.Add ActiveWorkbook.FullName
.Send
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
I tried the following to try and CC two people:
.CC = str4 & "; " & str5
however this doesn't work.
Can someone please help me get this to work?
Thank you so much
I have the following macro that works fine to send the active workbook to one recipient and one CC, with reference to two cells:
Sub Mail_Workbook() 'Excel VBA to send mail.
Dim OutApp As Object
Dim OutMail As Object
Dim str1 As String
Dim str2 As String
Dim str3 As String
Dim str4 As String
Dim str5 As String
str1 = [N3]
str2 = [N1]
str3 = [N2]
str4 = [T4]
str5 = [T5]
Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.TO = str1
.CC = str4
.Subject = str2
.Body = "Hello," & vbCrLf & vbCrLf & "Please find attached your latest statement." & vbCrLf & vbCrLf & "Please return your completed report by " & str3 & vbCrLf & vbCrLf & "Thank you" & vbCrLf & "Kind Regards,"
.Attachments.Add ActiveWorkbook.FullName
.Send
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
I tried the following to try and CC two people:
.CC = str4 & "; " & str5
however this doesn't work.
Can someone please help me get this to work?
Thank you so much