How to Batch Replace the Images in the Business Cards of All Outlook Contacts in the Same Company

If you want to batch replace the images in multiple contacts’ business cards, such as changing the images in the business cards of all contacts in the same company to the company logo, you can use the way introduced in this article.

Generally, to the contacts in the same company, you may want to utilize the same company logo in their business cards. Yet, modifying the images in the business cards of multiple contacts is an arduous and tedious task. Therefore, here we will introduce you another much more efficient and convenient way.

Batch Replace the Images in the Business Cards of All Contacts in the Same Company

  1. In the first place, launch Outlook VBA editor by “Alt + F11”.
  2. Then, copy the following VBA code into a module.
Dim objSampleContact As Outlook.ContactItem

Sub ReplaceBusinessCardImages_AllContactsInSameCompany()
    Dim objStore As Outlook.Store
    Dim objFolder As Outlook.Folder
 
    'Get the model contact whose business card style to be copied to other contacts
    Set objSampleContact = Outlook.Application.ActiveExplorer.Selection.Item(1)

    For Each objStore In Outlook.Application.Session.Stores
        For Each objFolder In objStore.GetRootFolder.Folders
            If objFolder.DefaultItemType = olContactItem Then
               Call ProcessContactsFolders(objFolder)
            End If
        Next
    Next
End Sub

Sub ProcessContactsFolders(ByVal objContactsFolder As Outlook.Folder)
    Dim i As Integer
    Dim objContact As Outlook.ContactItem
    Dim objSubfolder As Outlook.Folder
 
    For i = objContactsFolder.Items.Count To 1 Step -1
        If objContactsFolder.Items(i).Class = olContact Then
           Set objContact = objContactsFolder.Items(i)
 
           'Change the specific company
           If objContact.CompanyName = "DataNumen, Inc." Then
              'Copy the business card style
              objContact.BusinessCardLayoutXml = objSampleContact.BusinessCardLayoutXml
              'Change the path to the picture file
              objContact.AddBusinessCardLogoPicture ("E:\DataNumen Products\Logo.jpg")
              objContact.Save
           End If
        End If
    Next
 
    'Process all subfolders recursively
    If objContactsFolder.Folders.Count > 0 Then
       For Each objSubfolder In objContactsFolder.Folders
           Call ProcessContactsFolders(objSubfolder)
       Next
    End If
End Sub

VBA Code - Batch Replace the Images in the Business Cards of All Contacts in the Same Company

  1. Next, add this macro to Quick Access Toolbar with reference to “How to Run VBA Code in Your Outlook“.
  2. Eventually, follow the steps below to run this macro.
  • First off, double click on a contact to open it.
  • Then, in the Contact window, double click on the business card.
  • In the “Edit Business Card” window, change “Layout” to alter the position of the image in business card.Change Contact Business Card Layout
  • Eventually, select this contact and click the macro button in Quick Access Toolbar.Select a Model Contact and Run Macro
  • When macro finishes, you can see that the images in the business cards of all the contacts in the same firm have been modified, as shown in the following screenshot.Batch Replaced Images in Business Cards of Contacts in Same Company

Evade Outlook Data Loss

Outlook is prone to errors and damage. Thus you have to be careful all the time. A great number of factors are able to let you lose your Outlook data within seconds. For instance, if you accidentally download any virus-infected attachments from suspicious mails, the viruses can directly attack your Outlook file. And then, you will experience Outlook data corruption. In this case, Scanpst is definitely unable to help you. You can only resort to a more powerful utility, such as DataNumen Outlook Repair.

Author Introduction:

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