How to batch change file as format for all contacts in Outlook?
In general, the contact files are displayed as Last name First name in Outlook, but how can you quickly batch change the contact files as format to Company or other order as below screenshot shown? The Option Default “File as” order only can work for the new contact but not the existed ones. Here, I introduce a VBA code to batch change file as format for all existed contacts in Outlook.
Batch change file as for all contacts with VBA
Batch change file as for all contacts with VBA
1. Select the contacts you want to change the file as, press Alt + F11 keys to enable the Microsoft Visual Basic for Applications window.
2. Double click at ThisOutlookSession in Project-Project1 pane, and copy and paste below code to the blank script.
VBA: Change file as
Sub ChangeFileAsforContracts()
'UpdatebyExtendoffice20180404
Dim xSelItems As Object
Dim xItem As Object
Dim xContact As ContactItem
Dim xFileAs As String
On Error Resume Next
If Outlook.Application.ActiveExplorer.CurrentFolder.DefaultItemType <> olContactItem Then
MsgBox "Please select the contact folder first", vbInformation + vbOKOnly, "Kutools for Outlook"
Exit Sub
End If
Set xSelItem = Outlook.ActiveExplorer.Selection
For Each xItem In xSelItem
If xItem.Class = olContact Then
Set xContact = xItem
With xContact
If .CompanyName = "" Then
xFileAs = .FullName
Else
xFileAs = .CompanyName
End If
.FileAs = xFileAs
.Save
End With
End If
Next
End Sub
3. Press F5 key to run the code, then all selected contacts have been changed the file as company.
Note:
1. In the code, you can change CompanyName to other fields you want to display file as.
2. If there is no company information, it will display the full name.
Best Office Productivity Tools
Kutools for Outlook - Over 100 Powerful Features to Supercharge Your Outlook
📧 Email Automation: Out of Office (Available for POP and IMAP) / Schedule Send Emails / Auto CC/BCC by Rules When Sending Email / Auto Forward (Advanced Rules) / Auto Add Greeting / Automatically Split Multi-Recipient Emails into Individual Messages ...
📨 Email Management: Easily Recall Emails / Block Scam Emails by Subjects and Others / Delete Duplicate Emails / Advanced Search / Consolidate Folders ...
📁 Attachments Pro: Batch Save / Batch Detach / Batch Compress / Auto Save / Auto Detach / Auto Compress ...
🌟 Interface Magic: 😊More Pretty and Cool Emojis / Boost Your Outlook Productivity with Tabbed Views / Minimize Outlook Instead of Closing ...
👍 One-click Wonders: Reply All with Incoming Attachments / Anti-Phishing Emails / 🕘Show Sender's Time Zone ...
👩🏼🤝👩🏻 Contacts & Calendar: Batch Add Contacts From Selected Emails / Split a Contact Group to Individual Groups / Remove Birthday Reminders ...
Over 100 Features Await Your Exploration! Click Here to Discover More.