Using VBA to Change Business Card Image & Layout

Last reviewed on May 8, 2014   —  12 comments

After upgrading Outlook, the business card's on all contacts will use a bland gray image. While you can create a custom form that will apply to all new contacts, the business card on existing contacts won't be updated. This is to preserve any business cards you may have already updated. Also, if you use the default card image and add contact photos, the contact photos display on the business cards. However, when you replace the business card image, it will be used instead of any contact photo.

We have three code samples available. The VBA code sample on this page changes the business card image on selected contacts
from this:to this:
Change the business card image The default business card image

Code Sample 1 (below) works on *selected* contacts, not folders. You can select only the contacts you want to change and skip any you've already updated with logos. Code Sample 2 is similar but applies the card image to all contacts in the folder. We include a sample If... Then statement to limit the changes to contacts based on the value of the Private or Company field.

The VBA in Code Sample 3 picks up the BusinessCardLayoutXml from the selected contact and applies it to all other contacts in the folder or selection.

If the contact has a contact photo, it is not replaced. However, the new business card image will override the contact photo, as seen in these before and after screenshots. If you want to use the contact photo (when a contact has a photo) on the business cards, do not change the business card image!

Changing the business card image doesn't affect the contact photo.

Code Sample 1: Use VBA to update selected business card images

This code will change the business card image on selected contacts, as you can't change the business card image using a custom form.

This code sample replaces the current image - it does not move or re-size it. For example, if the card was previously customized with an image on the right, the code will keep the size and placement on the right. To move or re-size an image or customize the card background or text, you need to change the Business card XML.

Public Sub ChangeBusinessCardImage_SelectedContacts()
    Dim Session As Outlook.NameSpace
    Dim currentExplorer As Explorer
    Dim Selection As Selection
    Dim currentItem As Object
    Dim folder As Outlook.folder
    Dim obj As Object
    Dim strFirstName As String
    Dim strLastName As String
    Dim strFileAs As String

    Set currentExplorer = Application.ActiveExplorer
    Set Selection = currentExplorer.Selection

    On Error Resume Next

    For Each obj In Selection
    Set folder = currentItem.Parent
        'Test for contact and not distribution list
        If obj.Class = olContact Then
            Set objContact = obj

      With objContact
          obj.AddBusinessCardLogoPicture ("C:\image\outlook.png")
     End With
        End If


    Set Session = Nothing
    Set currentExplorer = Nothing
    Set obj = Nothing
    Set Selection = Nothing
    Set currentItem = Nothing
    Set folder = Nothing
End Sub

More photo and image commands

To add a contact photo, remove the contact photo, or to reset the business card to Outlook's default, replace obj.AddBusinessCardLogoPicture ("C:\image\outlook.png") in the code sample with one of the following lines:

obj.AddPicture ("path") 'adds a contact photo
obj.RemovePicture 'removes the contact photo
obj.ResetBusinessCard ' removes all custom formatting

Keep reading: Code Sample 2: Change the business card image on all contacts in a folder

Written by

Diane Poremsky
A Microsoft Outlook Most Valuable Professional (MVP) since 1999, Diane is the author of several books, including Outlook 2013 Absolute Beginners Book. She also created video training CDs and online training classes for Microsoft Outlook. You can find her helping people online in Outlook Forums as well as in the Microsoft Answers and TechNet forums.

Please post long or more complicated questions at Outlookforums.

12 responses to “Using VBA to Change Business Card Image & Layout”

  1. Kevin Kretschmer

    Hi Diane, This works realy great, however, I've been trying modify the code of your 3rd example so that I can setup a couple of Businss Cards to use specifcally as 'Style Templates'. Ideally the macro would pull the xml from the business card from a Specific Card Name I.e. Company Name on Business Card: 'CardTemplate1'. This would allow selecting specific contatcts and applying the sytle of the template card without having to select the template itself as the first selection. Unfortunatly I don't know any VBA other than to copy and past parts of script that already work and can tweak script for specific uses. What I would like to do is:

    Set olkItem = olkFolder.Items.Find("[CompanyName] = CardTemplate1") 'to Search for CardTemplate1 and then:
    Set oModel = Application.ActiveExplorer.olkItem.Item(1) 'use the Card found as the template.

    Of course the above doesn't work and I don't know how to get it to work. Do you have any quick ways to make this work?

  2. Steve

    Hi Diane,

    Just wanted to say thanks for the post. It was very helpful to me for getting all of the business cards in my contact list to a uniform look. Thanks again.

  3. Scott

    Can you help me. Code 4 is exactly what I'm looking for. ButI am not sure where you put the VBA code in Outlook 2007. Are you ableto guide me please? Thanks. Scott Baker.

  4. Manoj

    How do I print the business card exactly as it shows up in the Business Card view?

  5. Siraj Hussain

    Hello, Nice post. I tried it works but if i set the layout to left. if i want to set background on fit to edge it does not work. it just copy the small amount of picture and zoom that picture to the whole card. Is there any solution ?

Leave a Reply

If the Post Coment button disappears, press your Tab key.