Hello all,

Let me start off by saying that I'm not 100% sure that this post belongs here. Technically, this is a macro I've written in Excel. However, this portion of it involves sending e-mails through Outlook, so that's why I chose to post this here. If this belongs somewhere else, please let me know and I'll repost it over there. Else feel free to move this post over there


I've written a macro to automate the sending of certain reports that I have to send out every week. Everything works great, with one exception. One of the contact groups that gets these reports is called Thor CI. When the code resolves the recipients, it replaces the contact group with someone who's name is akin to Cici Thornstein. Her e-mail is akin to cici.thornstein(it won't let me put the at sign here, but that's the first half of the e-mail address). I have this issue with none of the other contact groups, and I've yet to have any luck searching a problem like this online. For now, I've just set the macro to display the e-mails instead of sending them and I manually change it myself. I'd rather just have the macro send out the e-mails if possible, so does anyone have any idea what I can do to stop this from happening? I know I could simply change the name of the contact group, but I'd rather learn what causes this and how to handle it in case it comes up again in the future.


Below is the part of the macro dealing with the emails, in case it helps:


Private Sub emails(groupName As String)
    Dim outlookApp As Outlook.Application
    Dim myMail As Outlook.MailItem
    Dim recipient As Outlook.recipient
    Dim subjectLine As String
    
    Set outlookApp = New Outlook.Application
    Set myMail = outlookApp.CreateItem(olMailItem)
    
    subjectLine = Split(groupName, " ")(0)
    
    With myMail
        .Recipients.Add (groupName)
        If Not .Recipients.ResolveAll Then
            For Each recipient In .Recipients
                If Not recipient.Resolved Then
                    .Display
                    ActiveInspector.CommandBars.ExecuteMso ("CheckNames")
                End If
            Next
        End If
        .subject = subjectLine
        .Body = "Your current inventory report is attached." 
        .Attachments.Add ActiveWorkbook.FullName
        .Display False
    End With
End Sub