How to Batch Change the Cases of All Contacts’ Full Names in Your Outlook

Perhaps you’ve discovered that your contacts’ full names are in various cases. If you would like to batch change the cases of contacts’ full names, you can use the method introduced in this article.

Sometimes, you may find that the formats of many contacts’ full names are multifarious, such as non-uniform cases of full names. For instance, you must prefer “John Smith” instead of “john SMITH”. Therefore, here we will teach you to batch change the cases of all contact’s full names to standardize them.

Batch Change the Cases of All Contacts' Full Names in Your Outlook

Batch Change the Cases of All Contacts’ Full Names

  1. To start with, launch your Outlook program.
  2. Then, in the main Outlook screen, you could press “Alt + F11” key buttons.
  3. Subsequently, in VBA editor window, copy and paste the following VBA code into an unused module.
Sub BatchChangeCasesOfAllContactsFullName()
 Dim objStores As Outlook.Stores
 Dim objStore As Outlook.Store

Set objStores = Outlook.Application.Session.Stores
 
 'Process all Outlook data files in your Outlook
 For Each objStore In objStores
 Call ProcessFolders(objStore.GetRootFolder.Folders)
 Next
End Sub

Sub ProcessFolders(ByVal objFolders As Folders)
    Dim objFolder As Folder
    Dim objItem As Object
    Dim objContact As ContactItem
    Dim strFirstName, strLastName As String
 
    For Each objFolder In objFolders
        If objFolder.DefaultItemType = olContactItem Then
           For Each objItem In objFolder.Items
               If objItem.Class = olContact Then
                  Set objContact = objItem
 
                  strFirstName = objContact.FirstName
                  strLastName = objContact.LastName
 
                  If Len(strFirstName) <> 0 Then
                     'Change the case in contact full name
                     strFirstName = UCase(Left(strFirstName, 1)) & LCase(Right(strFirstName, Len(strFirstName) - 1))
                     If Len(strLastName) <> 0 Then
                        strLastName = UCase(Left(strLastName, 1)) & LCase(Right(strLastName, Len(strLastName) - 1))
                     End If
                     'Change the displaying format of contact full name
                     objContact.FullName = strFirstName & " " & strLastName
 
                     On Error Resume Next
                     'Save the contact
                     objContact.Save
                 End If
              End If
          Next
       End If
       'Process all contacts folder recursively
       Call ProcessFolders(objFolder.Folders)
    Next
End Sub

VBA Code - Batch Change the Cases of All Contacts' Full Names

  1. After that, you can exit the current window.
  2. Later continue to add the macro to Quick Access Toolbar.
  • First off, go to “File” > “Options” > “Quick Access Toolbar”.
  • Then follow the steps shown in the screenshot below:Add the macro to Quick Access Toolbar
  1. Eventually, you can have a try. Just click on the macro button in Quick Access Toolbar. After macro finishes, you will see that all of your contacts’ full names are formatted, like the following picture:Changed Cases in Full Names

Restore Damaged PST Files

Outlook can be subject to all sorts of glitches now and then. Thus, it is common to encounter Outlook crashes for regular users. If unfortunately, you are confronted with damaged PST files, you should apply robust third party repair software to rescue your PST data. For instance, DataNumen Outlook Repair is a good choice. It is able to assist you to scan and fix Outlook PST files by minimizing corruption within minutes.

Author Introduction:

Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including mdf recovery and outlook repair software products. For more information visit www.datanumen.com

Comments are closed.