Ga naar hoofdinhoud

 Hoe gegevens van contacten exporteren met foto's in Outlook?

Wanneer u contacten vanuit Outlook naar een bestand exporteert, kan alleen de tekstinformatie van de contacten worden geëxporteerd. Maar soms heeft u de foto's nodig die moeten worden geëxporteerd, evenals de tekstinformatie van de contactpersonen, hoe zou u deze taak in Outlook kunnen aanpakken?

Exporteer de informatie van contacten met relatieve foto's met behulp van VBA-code


Exporteer de informatie van contacten met relatieve foto's met behulp van VBA-code

De onderstaande VBA-code kan u helpen om alle contacten in een specifieke contactmap te exporteren naar een apart tekstbestand met foto's. Doe alstublieft als volgt:

1. Selecteer een contactenmap waarvan u de contacten met foto's wilt exporteren.

2. En houd dan de ALT + F11 toetsen om de te openen Microsoft Visual Basic voor toepassingen venster.

3. Dan klikken Invoegen > Module, kopieer en plak onderstaande code in de geopende lege module, zie screenshot:

VBA-code: exporteer de informatie van contacten met foto's:

Sub BatchExportContactPhotosandInformation()
Dim xContactItems As Outlook.Items
Dim xItem As Object
Dim xContactItem As ContactItem
Dim xContactInfo As String
Dim xShell As Object
Dim xFSO As Scripting.FileSystemObject
Dim xTextFile As Scripting.TextStream
Dim xAttachments As Attachments
Dim xAttachment As Attachment
Dim xSavePath, xEmailAddress As String
Dim xFolder As Outlook.Folder
On Error Resume Next
Set xFSO = CreateObject("Scripting.FileSystemObject")
Set xShell = CreateObject("Shell.application").BrowseforFolder(0, "Select a Folder", 0, 16)
If xShell Is Nothing Then Exit Sub
xSavePath = xShell.Items.Item.Path & "\"
If Outlook.Application.ActiveExplorer.CurrentFolder.DefaultItemType <> olContactItem Then
    Set xFolder = Outlook.Application.Session.GetDefaultFolder(olFolderContacts)
Else
    Set xFolder = Outlook.Application.ActiveExplorer.CurrentFolder
End If
Set xContactItems = xFolder.Items
For i = xContactItems.Count To 1 Step -1
    Set xItem = xContactItems.Item(i)
    If xItem.Class = olContact Then
        Set xContactItem = xItem
        With xContactItem
            xEmailAddress = .Email1Address
            If Len(Trim(.Email2Address)) <> 0 Then
                xEmailAddress = xEmailAddress & ";" & .Email2Address
            End If
            If Len(Trim(.Email3Address)) <> 0 Then
                xEmailAddress = xEmailAddress & ";" & .Email3Address
            End If
            xContactInfo = "Name: " & .FullName & vbCrLf & "Email: " & _
                           xEmailAddress & vbCrLf & "Company: " & .CompanyName & _
                           vbCrLf & "Department: " & .Department & _
                           vbCrLf & "Job Title: " & .JobTitle & _
                           vbCrLf & "IM: " & .IMAddress & _
                           vbCrLf & "Business Phone: " & .BusinessTelephoneNumber & _
                           vbCrLf & "Home Phone: " & .HomeTelephoneNumber & _
                           vbCrLf & "BusinessFax Phone: " & .BusinessFaxNumber & _
                           vbCrLf & "Mobile Phone: " & .MobileTelephoneNumber & _
                           vbCrLf & "Business Address: " & .BusinessAddress
            Set xTextFile = xFSO.CreateTextFile(xSavePath & .FullName & ".txt", True)
            xTextFile.WriteLine xContactInfo
            If .Attachments.Count > 0 Then
                Set xAttachments = .Attachments
                For Each xAttachment In xAttachments
                    If InStr(LCase(xAttachment.FileName), "contactpicture.jpg") > 0 Then
                        xAttachment.SaveAsFile (xSavePath & .FullName & ".jpg")
                    End If
                Next
            End If
        End With
    End If
Next i
End Sub

doc export contacten met foto's 1

4. Na het plakken van de code in de module, blijf klikken Tools > Referenties in de Microsoft Visual Basic voor toepassingen raam, in de pop uit Referenties-Project1 dialoogvenster, vink aan Microsoft Scripting-runtime optie van de Beschikbare referenties keuzelijst, zie screenshot:

doc export contacten met foto's 2

5. Klikken OK om het dialoogvenster te sluiten en druk vervolgens op F5 sleutel om deze code uit te voeren, in de pop-out Blader naar de map dialoogvenster, specificeer een map waarin u de geëxporteerde contacten wilt uitvoeren, zie screenshot:

doc export contacten met foto's 3

6. Dan klikken OK, alle informatie met de foto's van de contacten is afzonderlijk naar uw specifieke map geëxporteerd, zie screenshot:

doc export contacten met foto's 4


Beste Office-productiviteitstools

Kutools for Outlook - Meer dan 100 krachtige functies om uw Outlook een boost te geven

🤖 AI Mail-assistent: Directe professionele e-mails met AI-magie: met één klik geniale antwoorden, perfecte toon, meertalige beheersing. Transformeer e-mailen moeiteloos! ...

???? Email Automation: Niet aanwezig (beschikbaar voor POP en IMAP)  /  Plan het verzenden van e-mails  /  Automatische CC/BCC volgens regels bij het verzenden van e-mail  /  Automatisch doorsturen (geavanceerde regels)   /  Begroeting automatisch toevoegen   /  Splits e-mails van meerdere ontvangers automatisch op in individuele berichten ...

📨 email management: Gemakkelijk e-mails herinneren  /  Blokkeer zwendel-e-mails van onderwerpen en anderen  /  Verwijder dubbele e-mails  /  Uitgebreid Zoeken  /  Consolideer mappen ...

📁 Bijlagen ProBatch opslaan  /  Batch losmaken  /  Batchcompressie  /  Automatisch opslaan   /  Automatisch loskoppelen  /  Automatisch comprimeren ...

???? Interface-magie: 😊Meer mooie en coole emoji's   /  Verhoog uw Outlook-productiviteit met weergaven met tabbladen  /  Minimaliseer Outlook in plaats van te sluiten ...

???? Wonderen met één klik: Beantwoord iedereen met inkomende bijlagen  /   Antiphishing-e-mails  /  🕘Toon de tijdzone van de afzender ...

👩🏼‍🤝‍👩🏻 Contacten en agenda: Batchcontacten toevoegen uit geselecteerde e-mails  /  Splits een contactgroep in individuele groepen  /  Verwijder verjaardagsherinneringen ...

Over 100 Eigenschappen Wacht op je verkenning! Klik hier om meer te ontdekken.

 

 

Comments (2)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Do you know that many (every ?) OpenSource alternative to Outlook are able to export contacts in vcard format, with all details and photos ?
Just with one click, no need to write any code...
Incredible, isn't it ?
This comment was minimized by the moderator on the site
It's because Oulook / Exchange are not free, you need to pay for everything ! :-)
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations