Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Linking Excel to Outlook Contact folder 3

Status
Not open for further replies.

fireydad

Technical User
Dec 13, 2008
1
US
Is there any way to link an Excel spreadsheet to the default Outlook contacts folder? I have been searching for a way but have not been able to find one.

The reason I want to do so is because we have been using the following macro to populate a listbox with each contact in the users default contact folder. Using this method takes over 30 seconds to populate the listbox because we have about 1800 contacts.

Private Sub UserForm_Activate()
Dim objOutlook As Outlook.Application
Dim fdrContacts As Outlook.MAPIFolder
Dim itmContacts As Outlook.ContactItem
Dim i As Integer
Dim NameArray() As String
Dim Cnt As Long

Set objOutlook = New Outlook.Application
Set fdrContacts = GetNamespace("MAPI").GetDefaultFolder(olFolderContacts)

For Each itmContacts In fdrContacts.Items
ReDim Preserve NameArray(Cnt)
NameArray(Cnt) = itmContacts.CompanyName & " " & itmContacts.FullName
Cnt = Cnt + 1
Next
WordBasic.SortArray NameArray
For i = 0 To Cnt - 1
lstCompanyList.AddItem NameArray(i)
Next i
End Sub

I have found it much faster to Export all of the Outlook 2003 contacts info to an Excel spreadsheet and the sort by Company, LastName, and FirstName. Once this is done I save the file and use it to populate the listbox which takes less than 1 second to list all 1800 contacts using ADO.

Once the user selects a contact from the listbox I use the index value as the Excel row number. Everything is good except the Excel data becomes out of date requiring the user to again export their contacts over and over in an attempt to keep up to date.

My 1st thought was to try writing a macro that would use Outlook's Import/Export Wizard to export the contacts just before populating the listbox. Assuming that was possible it would still take a considerable amount of time to export the contacts, sort them, save the file, and then populate the listbox.

If there is not a way to link the Excel document to the Contact list is there a way to know the which contacts have been updated, added, and deleted since the last time the Excel file was updated and then open the Excel file and update only the changed information?
 
fireydad and hermanlaksko,

A star to both of you. I was about to post a slightly different problem when I saw this thread. (I needed a way to iterate through a part of the Global Address List starting at a specified name.) Between the two of you, you gave me exactly what I needed to solve my problem!

Thanks,

LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top