简体   繁体   English

VBA Excel发送多个电子邮件

[英]VBA Excel Sending More than one Email

I am attempting to write a program that sends different managers emails regaurding their information. 我正在尝试编写一个程序,向不同的经理发送电子邮件以重新获得他们的信息。 For some rease the program will send only one email out and say it is completed with no errors. 对于某些问题,该程序将仅发送一封电子邮件,并说它已完成且没有错误。 How do I make it send all 14 emails. 如何使它发送所有14封电子邮件。 Right now the emails are all pointed at my direct email address. 现在,所有电子邮件都指向我的直接电子邮件地址。 Please Help! 请帮忙!

Dim i As Integer
i = 1

Do While i <> 14
On Error Resume Next
With OutMail
    .to = SupervisorAddress(i)
    .CC = ""
    .BCC = ""
    .Subject = "QTF Expired"
    .Body = Body(i)
    'You can add a file like this
    '.Attachments.Add ("C:\test.txt")
    .Send   'or use .Display
End With
On Error GoTo 0
i = i + 1
Loop
Dim i As Long

For i = 1 To 14
    With OutApp.CreateItem(0)
        .to = SupervisorAddress(i)
        .CC = ""
        .BCC = ""
        .Subject = "QTF Expired"
        .Body = Body(i)
        'You can add a file like this
        '.Attachments.Add ("C:\test.txt")
        .Send   'or use .Display
    End With
Next

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM