This article will share you a method to prevent the new contact group from having the same name as any existing groups.
If there are some contact groups that have the same name in your Contacts folder, you may frequently mix them up. For instance, in this situation, when you need to send an email to a contact group, you will find a bit troublesome to find the right group. To avoid this problem, you have to ensure that new contact group has the different name as any existing groups. Now, in the followings, we will introduce a method which can configure Outlook to auto warn you if the new group has the same name as an existing one.
Get Confirmed before Saving a Contact Group with an Existing Name
- For a start, launch Outlook VBA editor by referring to “How to Run VBA Code in Your Outlook“.
- Then, copy and paste the following VBA code into the “ThisOutlookSession” project.
Public WithEvents objInspectors As Outlook.Inspectors Public WithEvents objContactGroup As Outlook.DistListItem Private Sub Application_Startup() Set objInspectors = Outlook.Application.Inspectors End Sub Private Sub objInspectors_NewInspector(ByVal Inspector As Inspector) If TypeOf Inspector.CurrentItem Is DistListItem Then Set objContactGroup = Inspector.CurrentItem End If End Sub 'before saving the contact group Private Sub objContactGroup_Write(Cancel As Boolean) Dim strGroupName As String Dim objContactsFolder As Outlook.Folder strGroupName = LCase(objContactGroup.Subject) Set objContactsFolder = objContactGroup.Parent For Each objItem In objContactsFolder.Items If TypeOf objItem Is DistListItem Then 'If the new group's name is same as an existing one If LCase(objItem.Subject) = strGroupName Then 'Get confirmed strMsg = "There has been an existing group having the same name!" & vbCrLf & "Do you want to save it?" If MsgBox(strMsg, vbExclamation + vbYesNo) = vbYes Then Cancel = False Else Cancel = True End If Exit For End If End If Next End Sub
- After that, click into the “Application_Startup” subroutine and press “F5” key.
- Finally, you can have a try.
- First off, create a new contact group.
- Then, enter a name which is same as an existing group’s name.
- Later, try to save it by clicking “Save & Close” button.
- At once, you’ll get a message, like the following screenshot.
- If you select “No”, the contact group will not be saved and will keep open for you to change name.
- If you select “Yes”, the group will be saved immediately.
Abstain Outlook Data Loss
Numerous Outlook users have been plagued by PST data losses. Generally, in face of Outlook corruption, you need to firstly check if there’s an updated data backup available. If not, you can proceed to attempt to fix PST file by the inbox repair tool. At the worst, assuming that Scanpst fails, you have no alternative to invest in an experienced and creditworthy external utility, like DataNumen Outlook Repair.
Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including recover Sql Server and outlook repair software products. For more information visit www.datanumen.com