I would like to retrieve the email addresses from excel cells and copy them as recipients on outlook.
However, the "To" and "CC" on outlook are empty.
input and output:
Cell A1 is the email address which I want to "send to".
Cell A2 is the email address which I want to "CC to".
my VBA code:
Sub Button1_Click()
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)
On Error Resume Next
With OutMail
.To = Cells("A1")
.CC = Cells("A2")
.BCC = ""
.Subject = "This is the Subject line"
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub