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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Emails in Access to Outlook address book 1

Status
Not open for further replies.

DrDan1

Technical User
Oct 2, 2002
127
GB
Hi. I have a column in my Access 2000 database containing email addresses. Does anyone know if there is a way of putting these emails into my address book in Outlook 2000. Or if not Outlook then any other emailing software.

Thanx.
--Dan.
 
Yes you can, here is some sample code from the outlook help which shows the basic idea - you can start this from access and fill in the outlook fields from your database.

Code:
Sub CommandButton1_Click()
    myName = Item.To
    Set myNameSpace = Application.GetNameSpace("MAPI")
    Set myGAddressList = myNameSpace.AddressLists("Global Address List")
    Set myGEntries = myGAddressList.AddressEntries
    Set myGEntry = myGEntries(myName)
    myManager = myGEntry.Manager    
    Set myGEntry2 = myGEntries(myManager)
    Set myPAddressList = myNameSpace.AddressLists("Personal Address Book")
    Set myPEntries = myPAddressList.AddressEntries
    'Add a new AddressEntry object to the personal 
    'address collection with the name, address, and
    'manager of the name in your To field.
    Set myPEntry = myPEntries.Add("Microsoft Mail Address", myName)
    myPEntry.Address = myGEntry.Address
    myPEntry.Manager = myGentry.Manager
    'Update to persist the collection.
    myPEntry.Update
    'Now add the manager's info. to
    'the Personal address collection.
    Set myPEntry2 = myPEntries.Add("Microsoft Mail Address", myManager)
    myPEntry2.Address = myGEntry2.Address
    myPEntry2.Manager = myGentry2.Manager
    myPEntry2.Update
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top