By default, when you modify a contact’ email address, the email address of the contact group member corresponding to this contact won’t change accordingly. So, this post will share a way to realize “auto update member” with utmost ease.
The main reason why you change a contact’s email address is generally that the original email address is not useful any longer. Thus, when you change a contact’s email address, you had better modify the email address of corresponding contact group member, too. It may be a bit difficult as you have to find out all the contact groups that contain this contact and then change one by one. Hence, here we will teach you a method, which is able to achieve “auto update”.
Auto Update the Associated Group Member when Changing a Contact’s Email Address
- At the very outset, launch your Outlook application.
- Then in the main window, press “Alt + F11” key buttons.
- Subsequently, you will get into the “Microsoft Visual Basic for Applications” window.
- Now, you need to access the “ThisOutlookSession” project.
- Next, copy and paste the VBA code below into this project window.
Private WithEvents objInspectors As Inspectors Private WithEvents objContact As ContactItem Private strDisplayName As String Private Sub Application_Startup() Set objInspectors = Application.Inspectors End Sub Private Sub objInspectors_NewInspector(ByVal Inspector As Inspector) If Inspector.CurrentItem.Class = olContact Then Set objContact = Inspector.CurrentItem strDisplayName = objContact.Email1DisplayName End If End Sub 'Occurs when a contact gets changed Private Sub objContact_PropertyChange(ByVal Name As String) Dim objContacts As Items Dim i, n As Long Dim objContactGroup As DistListItem Dim objTempMail As MailItem Dim objTempRecipient As recipient 'If email address is changed If Name = "Email1Address" Then Set objContacts = objContact.parent.Items For i = objContacts.Count To 1 Step -1 If TypeOf objContacts(i) Is DistListItem Then Set objContactGroup = objContacts(i) For n = 1 To objContactGroup.MemberCount Set objGroupMember = objContactGroup.GetMember(n) 'Find the corresponding group member If InStr(1, objGroupMember.Name, strDisplayName) > 0 Then 'Ask if update corresponding group member If MsgBox("Update Corresponding Group Member?", vbQuestion + vbYesNo) = vbYes Then objContact.Email1DisplayName = objContact.FullName objContact.Save Set objTempMail = Application.CreateItem(olMailItem) Set objTempRecipient = objTempMail.Recipients.Add(objContact.FullName) objTempRecipient.Resolve If objTempRecipient.Resolved = True Then 'Remove the original member objContactGroup.RemoveMember objTempRecipient 'Add the new member with new email address objContactGroup.AddMember objTempRecipient objContactGroup.Save End If objTempMail.Close olDiscard End If End If Next End If Next End If End Sub
- After that, you ought to sign this macro and change your macro settings to enable signed macros.
- Later you could restart your Outlook application to activate the VBA project.
- From now on, every time when you change a contact’s email address, you’ll receive a message, asking if to update the corresponding group member.
- When you select “Yes”, Outlook will alter the email entry of the related group member at once.
Extract Maximum Data from Corrupted PST
No one can boast that they are capable of escaping from Outlook issues. Hence, it is an unquestioned fact that you ought to remain prepared for all unpredictable problems in Outlook. For example, you should keep backing up your Outlook data. It can get you from difficult Outlook repair when meeting PST corruption. Plus, it is prudent to get hold of a preeminent repair tool, such as DataNumen Outlook Repair.
Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including fix mdf and outlook repair software products. For more information visit www.datanumen.com