简体   繁体   中英

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. 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)':

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解决此问题

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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