To import contacts from your local Outlook Contacts folder into an Access table
(tblImportedContacts), use the following function (it can also be run from the
mcrImportContactsFromOutlook macro):
Public Function ImportContactsFromOutlook()
On Error GoTo ErrorHandler
Dim lngContactCount As Long
Dim fld As Outlook.Folder
Dim fldContacts As Outlook.Folder
Dim con As Outlook.ContactItem
Dim strFullName As String
Dim strFirstName As String
Dim strLastName As String
Dim strBusinessPhone As String
Dim strHomePhone As String
Dim strMobilePhone As String
Dim strFaxNumber As String
Dim strNotes As String
Dim strJobTitle As String
Dim strWorkAddress As String
Dim strWorkCity As String
Dim strWorkStateProv As String
Dim strWorkPostalCode As String
Dim strWorkCountry As String
Dim strHomeAddress As String
Dim strHomeCity As String
Dim strHomeStateProv As String
Dim strHomePostalCode As String
Dim strHomeCountry As String
Dim strCompanyName As String
Dim strEMail As String
Dim strSalutation As String
Dim itm As Object
Dim strSQL As String
Dim strWebSite As String
Set appOutlook = GetObject(, “Outlook.Application”)
Set nms = appOutlook.GetNamespace(“MAPI”)
Use the following line to import from the default local Contacts folder:
‘Set fldContacts = nms.GetDefaultFolder(olFolderTasks)
On Error Resume Next
Working with Outlook Items 8