Copy contact list from Outlook to Excel

MrVillareal

Well-known Member
Joined
Jun 27, 2011
Messages
504
Hi Mrexcel users,

How can I copy all contact list from the address book of Outlook to excel.

Thank you in advance.
Marvin
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Try this. You need to set a reference to Outlook in Tools > References

Code:
Sub GetOutlookContacts()

Dim olapp As Outlook.Application
Dim nspNameSpace As Outlook.Namespace
Dim fldContacts As Outlook.MAPIFolder
Dim objContact As Outlook.ContactItem
Dim iRow As Long
Dim sName As String

On Error Resume Next
Application.ScreenUpdating = False
Set olapp = New Outlook.Application
Set nspNameSpace = olapp.GetNamespace("MAPI")
Set fldContacts = nspNameSpace.GetDefaultFolder(olFolderContacts)
iRow = 1
Cells(iRow, 1).Resize(1, 5).Value = Array("Full Name", "First Name", "Middle Name", "Last Name", "Email Address 1")
For Each objContact In fldContacts.Items
    With objContact
        If objContact.Class = olContact Then

            iRow = iRow + 1
            Cells(iRow, 1).Value = .FullName
            Cells(iRow, 2).Value = .FirstName
            Cells(iRow, 3).Value = .MiddleName
            Cells(iRow, 4).Value = .LastName
            Cells(iRow, 5).Value = .Email1Address
            ActiveSheet.Hyperlinks.Add Cells(iRow, 5), Cells(iRow, 5).Value
        End If
    End With
Next objContact
Application.ScreenUpdating = True
Set objContact = Nothing
Set fldContacts = Nothing
Set nspNameSpace = Nothing
Set olapp = Nothing
End Sub
 
Upvote 0
Hi Peter,

Thank you for your time..In your answer is it extracting all list in the address book in outlook? And how will I work with your given code in outlook to copy them in excel? Should I copy the code and paste it using Alt F11 in outlook or in excel? And again I greatly appreciate your time thank you very much:)
 
Upvote 0
This code is run from Excel. It will write out your Outlook contact details to the active sheet.
 
Upvote 0
Actually Im looking for a way wherein from the address book of the outlook wherein global list of contacts are in there I want them to be extracted and copy it to excel.. Even better if the outlook list is updated then the excel copy should also be updated. Is this possible? Im considering the connections features in excel but I do not how to use that..
 
Upvote 0

Forum statistics

Threads
1,224,581
Messages
6,179,668
Members
452,936
Latest member
anamikabhargaw

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top