ajoyprabhu
Technical User
Hi all,
I have not seen an elegant solution for this problem-- I have various users that want to pool in thier Outlook contacts into one access database. I was thinking of having them setup a "Shared" folder in Outlook and using VBA import all the info into a table. Somethng like...
Get_Contact:
Dim appOutLook As Outlook.Application
Dim objContact As ContactItem
Dim objNameSpace As NameSpace
Dim objFolder As MAPIFolder
Set appOutLook = CreateObject("Outlook.Application")
Set objNameSpace = appOutLook.GetNamespace("MAPI")
Set objFolder = objNameSpace.GetDefaultFolder(olFolderContacts)
***NOT sure how to get the "Shared" folder name here ***
Dim MyRS As DAO.Recordset
Set MyRS = CurrentDb.OpenRecordset("Select * from Contacts", dbOpenDynaset)
Dim i As Long
For i = 1 To objFolder.Items.Count
With MyRS
***Here add for each outlook record... add new record***
.AddNew
![LastName] = .LastName ??? Not sure...
![EmailName] = .Email1Address ??? Not sure...
.Update
End With
Next
MyRS.Close
Set MyRS = Nothing
'release outlook
Set appOutLook = Nothing
Set objNameSpace = Nothing
Set objFolder = Nothing
How do I do this??? Thanks in advance.
Ajoy
I have not seen an elegant solution for this problem-- I have various users that want to pool in thier Outlook contacts into one access database. I was thinking of having them setup a "Shared" folder in Outlook and using VBA import all the info into a table. Somethng like...
Get_Contact:
Dim appOutLook As Outlook.Application
Dim objContact As ContactItem
Dim objNameSpace As NameSpace
Dim objFolder As MAPIFolder
Set appOutLook = CreateObject("Outlook.Application")
Set objNameSpace = appOutLook.GetNamespace("MAPI")
Set objFolder = objNameSpace.GetDefaultFolder(olFolderContacts)
***NOT sure how to get the "Shared" folder name here ***
Dim MyRS As DAO.Recordset
Set MyRS = CurrentDb.OpenRecordset("Select * from Contacts", dbOpenDynaset)
Dim i As Long
For i = 1 To objFolder.Items.Count
With MyRS
***Here add for each outlook record... add new record***
.AddNew
![LastName] = .LastName ??? Not sure...
![EmailName] = .Email1Address ??? Not sure...
.Update
End With
Next
MyRS.Close
Set MyRS = Nothing
'release outlook
Set appOutLook = Nothing
Set objNameSpace = Nothing
Set objFolder = Nothing
How do I do this??? Thanks in advance.
Ajoy