For years I have had code similar to the following, and it has always worked fine.
But now we recently updated to Win 11, perhaps it is related or there is some other update or policy change that happened at the same time.
But essentially, I can't read the mail I create from Excel, and I can't use ReplyRecipients.
Is this related to an recent update, or can this code get back to working condition again?
I realize the two lines of .To can be one line, but that isn't the solution.
I'm asking if we can read from the .To field and this code kind of demonstrates it.
We are using the old Outlook app.
The code requires the Outlook 16.0 Object library as a reference.
The error we get is 287.
Code below is for Excel VBA.
Sub mail()
Dim OutlookApp As Outlook.Application
Dim OutlookMail As Outlook.MailItem
Set OutlookApp = New Outlook.Application
Set OutlookMail = OutlookApp.CreateItem(olMailItem)
With OutlookMail
.BodyFormat = olFormatHTML
.Display
Signature = .HTMLBody ' does not work
.HTMLBody = "<b>Hello</b><br>" & Signature ' works ( without signature)
.ReplyRecipients.Add "[email protected]" ' does not work
.To = "[email protected]" ' works
.To = .To & "; [email protected]" ' does not work
End With
End Sub
Signatureis not populated? Maybe you do not have a signature in your email at all, I would not know. And where do you get the error 287? At which line?outlook-365andWindows-11 25H2. I am sure, it is due to your IT system and security policy.