gpt4 book ai didi

vba - excel vba,添加多个 .To 电子邮件地址

转载 作者:行者123 更新时间:2023-12-04 20:15:25 29 4
gpt4 key购买 nike

我正在使用以下代码使用 VBA 发送电子邮件。但是,没有发送电子邮件......我认为这是由于 '.To = ' 代码行中有多个电子邮件地址。有没有办法调整代码以允许多个电子邮件地址?

我试过看 Ron de Bruin 的例子,但是我什么都做不了?

Dim rng As Range
Dim OutApp As Object
Dim OutMail As Object

Set rng = Nothing
On Error Resume Next
Set rng = Selection.SpecialCells(xlCellTypeVisible)
On Error GoTo 0

Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)

On Error Resume Next
With OutMail
.To = "bob.johnson@email.com, john.smith@email.com"
.CC = ""
.BCC = ""
.Subject = "Open Orders where LF print to center of disc is required - " & Format(Now, "dd/mm/yyyy HH:mm")
.HTMLBody = "Please ensure discs for the following orders are run on replication lines that allow LF print to be printed to the center of the disc. " & Chr(10) & _
RangetoHTML(rng)
.Send
End With

最佳答案

尝试使用分号而不是逗号:

With OutMail
'.To = "bob.johnson@email.com, john.smith@email.com"
.To = "bob.johnson@email.com; john.smith@email.com"

关于vba - excel vba,添加多个 .To 电子邮件地址,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27981236/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com