[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

import outlook contacts  into excel 2003

Posted on 2011-09-20
4
Medium Priority
?
208 Views
Last Modified: 2012-05-12
Looking to code a button in excel to pull all my contacts from outlook into excel.
I would like to automate it so it runs by its self but will do it with a button..
This is for outlook and excel 2003… Please help.
0
Comment
Question by:cdb424ttm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 93

Expert Comment

by:Patrick Matthews
ID: 36568059
Outlook has a native capability to export your contacts to Excel.  Why not just use that?

Import / Export under File in the menu...
0
 

Author Comment

by:cdb424ttm
ID: 36568305
explain how I do this please, I tying to automate it so it check 3 or 4 times a day and keeps updating it's self...
0
 
LVL 93

Accepted Solution

by:
Patrick Matthews earned 2000 total points
ID: 36568925
OK, the following code when run from Excel will grab the contacts from Outlook.

Sub GrabTheContacts()
    
    Dim olApp As Object 'Outlook.Application
    Dim olFolder As Object 'Outlook.Folder
    Dim olItem As Object
    Dim DestR As Long
    Dim LastName As String
    
    Const olFolderContacts As Long = 10
    Const olContact As Long = 40
    
    Application.ScreenUpdating = False
    
    Workbooks.Add
    [a1:f1].Value = Array("LName", "FName", "Company", "Email1", "Office Phone", "Mobile Phone")
    DestR = 1
    
    Set olApp = CreateObject("Outlook.Application")
    Set olFolder = olApp.GetNamespace("Mapi").GetDefaultFolder(olFolderContacts)
    
    For Each olItem In olFolder.Items
        If olItem.Class = olContact Then
            DestR = DestR + 1
            With olItem
                LastName = Trim(.LastName)
                If LastName = "" Then LastName = "<none>"
                Cells(DestR, 1).Resize(1, 6) = Array(LastName, .FirstName, .CompanyName, .Email1Address, _
                    .BusinessTelephoneNumber, .MobileTelephoneNumber)
            End With
        End If
    Next
    
    [a1].Sort Key1:=[a1], Key2:=[b1], Order1:=xlAscending, Order2:=xlAscending, Header:=xlYes
    Application.ScreenUpdating = True
    MsgBox "Done"
    
End Sub

Open in new window

0
 

Author Closing Comment

by:cdb424ttm
ID: 36576929
Thanks for the quick response!! good work!
0

Featured Post

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Outlook for dependable use in a very small business   This article is about using the Outlook application (part of Microsoft Office) in a very small business, or for homeowners where dependability and reliability are critical requirements. This …
By default Outlook 2016 displays only one time zone in the Calendar. The following article explains how to display two time zones in one calendar view.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question