At work we are using Outlook 2016 and have recently upgraded to Microsoft Exchange. We have various VBA programs, run from Excel or Access, which create Outlook emails and save them in the Drafts folder, ready to be checked and sent by hand after running the program. These programs used to work before we went over to Microsoft Exchange. Now, when I double-click one of the emails that were saved in Drafts by whichever program I was running, Outlook refuses to send it, and reports the error "The operation failed." No other information or error codes are provided. One of my colleagues has the same problem. Others do not. In theory we should all have the same version of Outlook and Microsoft Exchange. I have discovered that I can reproduce this problem by running code directly within Outlook. I did Alt-F11, enabled macros, inserted a module and pasted the following code into the window.
Sub TestEmail2()
Dim OutMail As Outlook.MailItem
Dim EmailTo As String
Dim EmailSubject As String
EmailTo = "[email protected]"
EmailSubject = "Test Email 2"
Set OutMail = Application.CreateItem(0)
With OutMail
.To = EmailTo
.Subject = EmailSubject
.Save
.Close 0 ' olSave
End With
Set OutMail = Nothing
Debug.Print "Finished"
End Sub
If I set a breakpoint at "Set OutMail = Nothing", and run the code to that breakpoint (so "Set OutMail = Nothing" hasn't executed yet), then go to my Drafts folder and try to send the email, it will go without errors. If I rerun the code and allow it to run to completion, I get the error if I try to send the email it generates.
I would like to either (1) find a workaround that I can add to the code so I can send messages or (2) find out what is wrong with my Outlook profile so I can ask our IT helpdesk to change it, or change it myself. I don't want our IT helpdesk to reset my profile to the default settings and lose my customisations.