Note: The other languages of the website are Google-translated. Back to English
English English
  • Documenti
  • Outlook
  • Come modificare in batch il file come formato per tutti i contatti in Outlook?

Come modificare in batch il file come formato per tutti i contatti in Outlook?

In generale, i file dei contatti vengono visualizzati come Cognome Nome in Outlook, ma come puoi modificare rapidamente in batch i file dei contatti come formato in Società o altro ordine come mostrato nell'immagine sottostante? L'ordine predefinito dell'opzione "Archivia come" può funzionare solo per il nuovo contatto ma non per quelli esistenti. Qui, introduco un codice VBA per modificare in batch il file come formato per tutti i contatti esistenti in Outlook.

File di modifica batch come per tutti i contatti con VBA


File di modifica batch come per tutti i contatti con VBA

1. Selezionare i contatti con cui si desidera modificare il file, premere Alt + F11 tasti per abilitare il Microsoft Visual Basic for Applications finestra.

2. Fare doppio clic su ThisOutlookSession in Project-Project1 riquadro e copia e incolla sotto il codice nello script vuoto.

VBA: cambia file come

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.


Kutools for Outlook - Brings 100 Advanced Features to Outlook, and Make Work Much Easier!

  • Auto CC/BCC by rules when sending email; Auto Forward Multiple Emails by custom; Auto Reply without exchange server, and more automatic features...
  • BCC Warning - show message when you try to reply all if your mail address is in the BCC list; Remind When Missing Attachments, and more remind features...
  • Reply (All) With All Attachments in the mail conversation; Reply Many Emails in seconds; Auto Add Greeting when reply; Add Date into subject...
  • Attachment Tools: Manage All Attachments in All Mails, Auto Detach, Compress All, Rename All, Save All... Quick Report, Count Selected Mails...
  • Powerful Junk Emails by custom; Remove Duplicate Mails and Contacts... Enable you to do smarter, faster and better in Outlook.
shot kutools outlook kutools tab 1180x121
shot kutools outlook kutools plus tab 1180x121
 
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
Leave your comments
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations

Follow Us

Copyright © 2009 - www.extendoffice.com. | All rights reserved. Powered by ExtendOffice. | Sitemap
Microsoft and the Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.
Protected by Sectigo SSL