Am 04.06.2010 20:42, schrieb Abe Katz:
Hello,
Is there a way to get the Email address list from Outlook and input to a
Combo control using Ac2003?
Thanks in advance
Well you could insert your contact data into a table. I wrote a code for
that.
Sub GetOutlookContacts()
Dim outWorkspace As Object
Dim appOut As New Outlook.Application
Dim objKon As Object
Dim intz As Integer
Dim strName As String
Dim strFirstname As String
Dim strMail As String
Dim rst As New ADODB.Recordset
Dim conn As ADODB.Connection
On Error GoTo mistake
Set conn = CurrentProject.Connection
rst.Open "SELECT * FROM tblMailadress", conn, adOpenKeyset, adLockOptimistic
Set outWorkspace = _
appOut.GetNamespace("MAPI").GetDefaultFolder(olFolderContacts)
'clear table
CurrentDb.Execute "DELETE * FROM tblMailadress", 128 'dbFailOnError
'fill table
For intz = 1 To outWorkspace.Items.Count
Set objKon = outWorkspace.Items(intz)
strName = objKon.LastName
strFirstname = objKon.FirstName
strMail = objKon.Email1Address
rst.AddNew
rst!LastName = strName
rst!FirstName = strFirstnamename
rst!Email = strMail
rst.Update
Next intz
rst.Close
conn.Close
Set objKon = Nothing
Set appOut = Nothing
Set conn = Nothing
Set rst = Nothing
Exit Sub
mistake:
MsgBox Err.Number & " " & Err.Description
End Sub
I hope this will help you!
Regards
Jörn