excel - Getting a "System Error &H80080005 (-2146959355). Server execution failed" when sending an ema

I have an Excel sheet that acts as a 'form' and uses VBA to walk users through the workflow.

I have an Excel sheet that acts as a 'form' and uses VBA to walk users through the workflow. When the next persons input is needed, the user presses a 'Submit' button and VBA triggers an email to inform the next person of their action. This is the code that sends the email:

            'will open email for sucsessful submit
            ' /
            Dim OutlookApp As Object
            Dim OutlookMail As Object
    
            ' Create a new instance of Outlook
            Set OutlookApp = CreateObject("Outlook.Application")
    
            ' Create a new email
            Set OutlookMail = OutlookApp.CreateItem(0)
    
            ' Set the properties of the email
            With OutlookMail
                .To = ActiveWorkbook.Worksheets("sheet").Range("A7")
                .CC = ""
                .BCC = ""
                .Subject = ActiveWorkbook.Worksheets("sheet").Range("A8")
                .Body = ActiveWorkbook.Worksheets("sheet").Range("A9")
                .Display 'Use .Send instead of .Display to send the email without displaying it
            End With
    
            ' Clean up
            Set OutlookMail = Nothing
            Set OutlookApp = Nothing

This works. I do not get any errors with this.

Some users got the following error:

But this was resolved by updating Microsoft Office which was available through IT.

Then a second problem occurred, with the same error, but only situationally:

If the user presses the 'Submit' button with Outlook OPEN, the email generation will fail. If they CLOSE Outlook, and press 'Submit', it works fine. The error is the SAME as above:

What could possibly cause this? This does not happen on my machine at all, which has made troubleshooting tough as it simply does not happen to me. Does anyone have any thoughts? Thanks in advance.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744133066a4559928.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信