Note: The other languages of the website are Google-translated. Back to English

Kako paketno spremeniti datoteko kot obliko za vse stike v Outlooku?

Datoteke s stiki so v Outlooku na splošno prikazane kot Last name (Ime), kako pa lahko hitro spremenite datoteke s stiki kot obliko v Company ali v drug vrstni red, kot je prikazano na spodnji sliki zaslona? Možnost Privzeto naročilo »Datoteka kot« lahko deluje samo za nove stike, ne pa tudi za obstoječe. Tukaj predstavljam kodo VBA za paketno spremembo datoteke kot obliko za vse obstoječe stike v Outlooku.

Datoteka za paketno spremembo kot za vse stike z VBA


Datoteka za paketno spremembo kot za vse stike z VBA

1. Izberite stike, v katere želite spremeniti datoteko, in pritisnite Alt + F11 tipke, da omogočite Microsoft Visual Basic for Applications okno.

2. Dvokliknite na ThisOutlookSession in Project-Project1 podokno ter kopirajte in prilepite spodnjo kodo v prazen skript.

VBA: Spremenite datoteko kot

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