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.
AI Mail Assistant in Outlook: Smarter Replies, Clearer Communication (one-click magic!) FREE
Streamline your daily Outlook tasks with the AI Mail Assistant from Kutools for Outlook. This powerful tool learns from your past emails to offer intelligent and accurate responses, optimize your email content, and help you draft and refine messages effortlessly.
This feature supports:
- Smart Replies: Get responses crafted from your past conversations—tailored, precise, and ready to go.
- Enhanced Content: Automatically refine your email text for clarity and impact.
- Effortless Composition: Just provide keywords, and let AI handle the rest, with multiple writing styles.
- Intelligent Extensions: Expand your thoughts with context-aware suggestions.
- Summarization: Get concise overviews of long emails instantly.
- Global Reach: Translate your emails into any language with ease.
This feature supports:
- Smart email replies
- Optimized content
- Keyword-based drafts
- Intelligent content extension
- Email summarization
- Multi-language translation
Best of all, this feature is completely free forever! Don’t wait—download AI Mail Assistant now and enjoy!
Best Office Productivity Tools
Breaking News: Kutools for Outlook Launches Free Version!
Experience the all-new Kutools for Outlook FREE version with 70+ incredible features, yours to use FOREVER! Click to download now!
📧 Email Automation: Auto Reply (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: 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 / Remind you when important emails come / 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 ...