excel - 按唯一标识符发送电子邮件,按 ID 分组 #
问题描述
我被这个困住了。我想要做的是循环每个 ID 并按支持联系人对它们进行分组,并通过电子邮件向这些人发送关于 ID 的电子邮件,它可能是电子邮件正文中的一个句子或表格。
ID Support Name Support Contact Decision MN-888 Qwe qwe@yahoo.com Yes MN-111 Asd asd@yahoo.com Yes MN-999 Qwe qwe@yahoo.com Yes MN-034 Ppp ppp@yahoo.com Yes
期望的输出:
亲爱的奎,
请返回 ID #MN-888, MN-999
我卡住的代码
Sub Test1()
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("C").Cells.SpecialCells(xlCellTypeConstants)
If cell.Value Like "?*@?*.?*" And _
LCase(Cells(cell.Row, "D").Value) = "yes" Then
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.To = cell.Value
.Subject = "Reminder"
.Body = "Dear " & Cells(cell.Row, "B").Value _
& vbNewLine & vbNewLine & _
"Please return ID # " & Cells(cell.Row, "A").Value _
.Send 'Or use Display
End With
On Error GoTo 0
Set OutMail = Nothing
End If
Next cell
cleanup:
Set OutApp = Nothing
Application.ScreenUpdating = True
End Sub
解决方案
推荐阅读
- python - 标签有条件地出现
- javascript - 为什么我的动画最后会传送到左下角
- c - C程序添加2个多项式然后显示它
- javascript - 页面重定向后,如何使用纯 JavaScript 保存包含对象的数组?
- c - 在C中从结构指针到函数执行函数
- twilio - Twilio API PHP:仅检索从某个手机号码(FROM)收到的最新短信
- sql - 如何使用计数功能
- c# - 如何以 xamarin 形式打印生成的条码 ZXING
- azure - 使用 ARM 模板使用 AppService 出站 IP 更新现有 Key Vault 防火墙 ACL
- python - InvalidImageFormatError 异常 源文件似乎不是图像