简体   繁体   English

VBA运行时错误:为什么在使用mailenvelope通过Outlook发送邮件时出现错误

[英]VBA runtime error : Why am i getting an error while sending mail through outlook using mailenvelope

I have a code for sending multiple emails on one click to several email id's. 我有一个代码,可以一键发送多个电子邮件到多个电子邮件ID。 The code works absolutely fine if the data is limited, however if the my data sheet contains large amount of data then it throws a run time error as below: 如果数据有限,代码可以正常工作,但是如果我的数据表中包含大量数据,则会引发运行时错误,如下所示:

"Run-time error '-2147417856 (80010100)': “运行时错误'-2147417856(80010100)”:

The operation failed because of network or other communication problems. 由于网络或其他通信问题,操作失败。 Verify your connection and try again." 验证您的连接,然后重试。”

Not sure why this happens. 不知道为什么会这样。 I have to then delete the data for the emails already sent and again start the macro and it again throws an error. 然后,我必须删除已经发送的电子邮件的数据,然后再次启动宏,并再次引发错误。

Can someone please help regarding this error 有人可以帮忙解决这个错误

With ActiveSheet.MailEnvelope
    .Introduction = Sheet3.Range("D2").Value

    With .Item
        .To = R
        .CC = S
        .BCC = T
        .Subject = Sheet3.Range("D1") & " - " & company_name
        .Send
    End With
End With

I expect the code to run normally irrespective of the data i put in because i have not given any specific range in my coding 我希望代码无论输入的数据如何都能正常运行,因为我没有在编码中指定任何特定范围

通过在.send行之后添加DoEvents解决此问题

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

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