Automating Outlook from within Excel (2016) using VBA, I'm using fairly standard code to create a new mail object, set the To, Subject, Attachments, and Body, and display.
On Error Resume Next
Set oOutlookApp = GetObject(, "Outlook.Application")
If Err <> 0 Then
Set oOutlookApp = CreateObject("Outlook.Application")
Set oItem = oOutlookApp.CreateItem(olMailItem)
.To = tostring
.Subject = "Project Field Schedule: " & skeddeets.Cells(3, 2) & " " & skeddeets.Cells(3, 4)
.Body = "Attached please find the latest Field Schedule for the " & skeddeets.Cells(3, 2) & " " _
& skeddeets.Cells(3, 4) & " project." & vbCrLf & vbCrLf & vbCrLf
Sometimes it works fine, but about half the time I get this error message:
When I dismiss the error a looking at the new mail item, I can in fact see multiple redundant fields in the new email "form." And I can't edit the body or send the email. Where did these 'ghost' fields come from? I've never seen these when I create a New Email from within Outlook. How can I fix this error? Thanks!