Consulting

Results 1 to 2 of 2

Thread: Unify name of sender when received

  1. #1
    VBAX Newbie
    Joined
    Apr 2017
    Location
    Hamburg
    Posts
    1
    Location

    Unify name of sender when received

    Hello,

    I am receiving plenty of emails from POP accounts used on different devices. Unfortunate the users set different names in the different configs and so it is difficult to search and sort. As the sender are mostly located in Far East there are also variants in local characters which is not helpful. Therefor I tried my best to write a small VB code which set a unified sender name while receiving an email - one name by email address.<br>Here is what I have tried so far:<br>
    Unfortunately SenderName is protected and cannot be changed and I do not find a way around. Can anyone help, please?

    Sub test(MyMail As MailItem)
    
        Dim strID As String
        Dim olNS As Outlook.NameSpace
        Dim olMail As Outlook.MailItem
        
        strID = MyMail.EntryID
        Set olNS = Application.GetNamespace("MAPI")
        Set olMail = olNS.GetItemFromID(strID)
                
    
    
        If olMail.SenderEmailAddress = "email.address" Then
            olMail.SenderName = "John Doe"
            olMail.Save
        End If
        
        Set olMail = Nothing
        Set olNS = Nothing
    
    
    End Sub

  2. #2
    You cannot do what you suggest. The sender is not an editable property of the message. I would suggest using sub folders and rules to direct the various alternatives to the appropriate sub folder.
    Graham Mayor - MS MVP (Word) 2002-2019
    Visit my web site for more programming tips and ready made processes
    http://www.gmayor.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •