让宏运行并很好地刮取姓名和邮件地址,但我无法让发送的 mial 中的文本出现在不同的行上,它显示为一长行文本。我尝试添加 vbline 等,但没有任何区别
在 Sub mailtoo()
Dim OutApp As Object
Dim OutMail As Object
Dim cell As Range
Application.ScreenUpdating = False
Set OutApp = CreateObject("Outlook.Application")
On Error GoTo cleanup
For Each cell In Columns("b").Cells.SpecialCells(xlCellTypeConstants)
If cell.Value Like "?*@?*.?*" And _
LCase(Cells(cell.Row, "c").Value) = "yes" Then
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.To = cell.Value
.Subject = "for Action"
.Body = "Dear " & Cells(cell.Row, "A").Value _
& vbNewLine & vbNewLine & _
"line one of text here. " & _
"line two of text here" & _
"line three of text here" & _
"Regards" & _
"your name"
.Attachments.Add "C:\demofilename.xlsx"
.Send 'Or use Display
End With
On Error GoTo 0
Set OutMail = Nothing
End If
Next cell
清理:
Set OutApp = Nothing
Application.ScreenUpdating = True
结束子