您好,我有一个宏,应该将电子邮件发送到我的 C 列上的地址,并复制到 F 列中的电子邮件地址和一些文本...但我的问题是它没有遍历每个名称,只是转到最后一个...有人可以帮我弄清楚我做错了什么吗?
Sub Send_Email()
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
Dim cel As Range
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
For Each cel In Range(("C2"), Range("C2").End(xlDown))
strbody = "Hi there" & vbNewLine & vbNewLine & _
"My name Is William" & vbNewLine & _
"I work at Fair" & vbNewLine & _
"Bye" & vbNewLine & _
"WH"
On Error Resume Next
With OutMail
.To = cel.Value '"email.address@fair.com"
.CC = cel.Offset(0, 3).Value & "Ivan.Martinez@fair.com"
.BCC = ""
.Subject = "Information You Requested"
.Body = strbody
.Display
'.Attachments.Add ("C:\test.txt")
'.Send
End With
On Error GoTo 0
Next cel
Set OutMail = Nothing
Set OutApp = Nothing
结束子