A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

How to get Email address list from Outlook to Msaccess



 
 
Thread Tools Display Modes
  #1  
Old June 4th, 2010, 07:42 PM posted to microsoft.public.access.forms
Abe Katz
external usenet poster
 
Posts: 43
Default How to get Email address list from Outlook to Msaccess

Hello,
Is there a way to get the Email address list from Outlook and input to a
Combo control using Ac2003?
Thanks in advance


Ads
  #2  
Old June 4th, 2010, 09:00 PM posted to microsoft.public.access.forms
Jörn Bosse
external usenet poster
 
Posts: 7
Default How to get Email address list from Outlook to Msaccess

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(olFol derContacts)

'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
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:47 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright ©2004-2017 OfficeFrustration.
The comments are property of their posters.