Skip to main content

 Hoe exporteer je contactinformatie inclusief foto's in Outlook?

Author: Xiaoyang Last Modified: 2025-05-29

Wanneer je contacten uit Outlook naar een bestand exporteert, kan alleen de tekstuele informatie van de contacten worden geëxporteerd. Maar soms heb je ook de foto's nodig, naast de tekstuele informatie van de contacten. Hoe kun je deze taak in Outlook aanpakken?

Exporteer contactinformatie met bijbehorende foto's door middel van VBA-code


Exporteer contactinformatie met bijbehorende foto's door middel van VBA-code

De onderstaande VBA-code kan je helpen om alle contacten in een specifieke contactenmap te exporteren naar afzonderlijke tekstbestanden met foto's. Doe het volgende:

1. Selecteer een contactenmap waaruit je de contacten met foto's wilt exporteren.

2. Druk vervolgens tegelijkertijd op de toetsen "ALT" + "F11" om het venster "Microsoft Visual Basic for Applications" te openen.

3. Klik daarna op "Invoegen" > "Module", kopieer en plak de onderstaande code in de geopende lege module, zie screenshot:

VBA-code: exporteer contactinformatie 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 contacts with photos 1

4. Nadat je de code in de module hebt geplakt, klik je verder op "Tools" > "References" in het venster "Microsoft Visual Basic for Applications". Schakel in het pop-upvenster "References-Project1" de optie "Microsoft Scripting Runtime" aan in de lijst met "Beschikbare referenties", zie screenshot:

doc export contacts with photos 2

5. Klik op "OK" om het dialoogvenster te sluiten en druk vervolgens op de toets "F5" om de code uit te voeren. In het pop-upvenster "Bladeren voor map" selecteer je een map waar je de geëxporteerde contacten wilt opslaan, zie screenshot:

doc export contacts with photos 3

6. Klik daarna op "OK". Alle informatie inclusief de foto's van de contacten is nu geëxporteerd naar je specifieke map, zie screenshot:

doc export contacts with photos 4

Beste productiviteitstools voor Office

Breaking News: Kutools voor Outlook lanceert gratis versie!

Ervaar de geheel nieuwe gratis versie van Kutools voor Outlook met meer dan70 geweldige functies, voor altijd gratis te gebruiken! Klik om nu te downloaden!

🤖 Kutools AI : Maakt gebruik van geavanceerde AI-technologie om e-mails moeiteloos te verwerken, waaronder beantwoorden, samenvatten, optimaliseren, uitbreiden, vertalen en opstellen van e-mails.

📧 E-mailautomatisering: Automatisch antwoorden (beschikbaar voor POP en IMAP) / E-mails verzenden volgens schema / Automatisch CC/BCC op basis van regels bij het verzenden van e-mails / Automatisch doorsturen (Geavanceerde regels) / Automatisch begroeting toevoegen / E-mails met meerdere ontvangers automatisch splitsen naar individuele berichten ...

📨 E-mailbeheer: E-mail terughalen / Scam-e-mails blokkeren op onderwerp en andere criteria / Dubbele e-mails verwijderen / Geavanceerd Zoeken / Organiseer mappen ...

📁 Bijlagen Pro: Batch opslaan / Batch loskoppelen / Batch comprimeren / Automatisch opslaan / Automatisch loskoppelen / Automatisch comprimeren ...

🌟 Interface Magic: 😊Meer mooie en coole emoji's / Herinnering bij belangrijke e-mails / Minimaliseer Outlook in plaats van afsluiten ...

👍 One-click Wonders: Antwoord Allen met Bijlagen / Anti-phishing e-mails / 🕘Toon tijdzone van afzender ...

👩🏼‍🤝‍👩🏻 Contacten & Agenda: Batch contact toevoegen vanuit geselecteerde e-mails / Een contactgroep splitsen naar individuele groepen / Verjaardagsherinnering verwijderen ...

Ontgrendel direct Kutools voor Outlook met één klik. Wacht niet langer, download nu en verhoog je efficiëntie!

kutools for outlook features1 kutools for outlook features2