VBA 批量提交电子邮件到 Outlook - 效率

问题描述 投票:0回答:1

有什么方法可以将

MailItem
的集合提交到outlook并指示它一次性发送全部吗?

现在,我的代码将循环访问数千个电子邮件地址,并在每次迭代时发送一封电子邮件。需要几个小时才能完成。下面是经过编辑的代码部分。

    Do
        emailBody = "email body"
    
        Set OutlookMail = OutlookApp.CreateItem(olMailItem)
        With OutlookMail
            .SentOnBehalfOfName = "[email protected]"
            .To = "[email protected]"
            .BCC = "[email protected]"
            .BodyFormat = olFormatHTML
            .Subject = "Subject"
            .HTMLBody = "<font style=""font-family: Poppins; font-size: 11pt;"">" & emailBody & "</font>"
            .Send
        End With
        
        ' Increment by the number of rows that were on this email.
        currRow = currRow + 1
        
    Loop While currRow < 2000

如果可以创建一批电子邮件并一次发送全部邮件,是不是比等待 Outlook 发送后再继续创建下一封电子邮件更高效?

excel vba email outlook
1个回答
0
投票

MailItem.Send
是异步的:它不等待提交完成。如果您评论我们的
Send
或将其替换为
Save
,您的代码将需要同样长的时间。

© www.soinside.com 2019 - 2024. All rights reserved.