Some users get used to managing their contacts by color categories. Also, contacts in different categories have some specific features, such as having different business card layouts. This article will show you how to let Outlook auto change the business card layout of the contact depending on its category.
Outlook allows users to show their contacts in Business Card. Furthermore, users can design the contact business card from the perspective of card layout, image and background, etc. as per their own preferences.
In addition, some users also prefer to classify their contacts by color categories. At the same time, they desire that the business cards of the contacts in a specific category should be in a specified layout. It can make their contacts more orderly. If you always manually change the business card layout when assigning a specific category to a contact, it will be a bit troublesome. Why not make it automatic? Via VBA, you can let Outlook do it automatically. Here are the detailed steps and VBA code.
Auto Change the Layout of a Contact Business Card as Per Color Category
- At first, you ought to determine a model contact whose business card layout you wish to use as an example. Change its business card based on your actual needs.
- After that, you can press “Alt + F11” key buttons to get access to VBA editor.
- Then in the popup window, you should open the “ThisOutlookSession” VBA project and copy the following VBA codes into it.
Public WithEvents olItems As Outlook.Items Sub application_startup() Set olItems = Application.Session.GetDefaultFolder(olFolderContacts).Items End Sub Sub olItems_Itemchange(ByVal Item As Object) Dim obj As Object Dim oModelcontact As ContactItem Dim olXml As String For Each obj In olItems 'Pick out the model contact whose business card layout you want to use as a model 'You can change "John Smith" as per your actual case If obj.FullName = "John Smith" Then Set oModelcontact = obj 'olXml refers to the layout of the model contact olXml = oModelcontact.BusinessCardLayoutXml End If Next 'Apply the model layout to the contacts in the specifc categories 'You can change "Test" to your actual needed category name If Item.Class = olContact And Item.Categories = "Test" Then Item.BusinessCardLayoutXml = olXml Item.Save Item.Display End If End Sub
- Subsequently, you should proceed to digitally sign the new macro and change your Outlook macro security level to low.
- Finally, you can restart to activate the VBA project and have a try.
- Firstly, assign the specific category to a contact.
- Then the contact will display in its own window. You can see its business card has been changed.
Must-Haves in Outlook Data Protection
Due to the fact that Outlook is vulnerable, you should pay much attention to data protection in Outlook. Here are some necessities. The first one is a consistent and up-to-date data backup. Then the second is the free tool, Scanpst.exe. And the last but not the least one is a reputable and well-proven Outlook corruption recovery tool, such as DataNumen Outlook Repair, which will come in handy when backup and inbox tool both fail.
Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including repair corrupted SQL mdf database and outlook repair software products. For more information visit www.datanumen.com