Skip to main content

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

doc change file as 3

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

πŸ€– AI Mail Assistant: Instant pro emails with AI magic--one-click to genius replies, perfect tone, multilingual mastery. Transform emailing effortlessly! ...

πŸ“§ 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 ProBatch 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.

Read More       Free Download      Purchase
 

 

Comments (1)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
I run the script above in 5 min and saved hours!! GREAT!
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
Rate this post:
0   Characters
Suggested Locations