Add Contacts from Access 2k to outlook 2k
Posted: 2002-06-01
By: ArchiveBot
Viewed: 66
Filed Under:
No attachments for this post
This code will send customer information such as Name address , city, state, zip to outlook2 contacts
Original Author: John Pope
Assumptions
You will need to set the references to use the Outlook 9.0 Object library.
Code
Private Sub cmdAddOutlook_Click()
'I have used this code in two ways. I have made this one here just work in the cmdbutton that I created on the Access form and placed all the code in here
'You can also make this a function
Dim oOutlook As Outlook.Application
Dim oContact As Outlook.ContactItem
'Create Object
Set oOutlook = New Outlook.Application
'Create and new Contact
Set oContact = oOutlook.CreateItem(olContactItem)
With oContact
'Change what you need in here. All Vairables after the = sign are fields in my database.
'You will need to change them to fields that you have in yours.
'To find a list of the items here you can set go to the object browser.
.FullName = LastName & "," & FirstName
.BusinessAddress = Address
.BusinessAddressCity = City
.BusinessAddressState = State
.BusinessAddressPostalCode = Zip
.HomeTelephoneNumber = HomePhone
.BusinessTelephoneNumber = BusPhone
.MobileTelephoneNumber = CellPhone
.Email1Address = Email
.CompanyName = CompanyName
.Categories = CompanyName
.Save
End With
'Change msgbox ot what you want it to say. I just left it simple
MsgBox "Contact has been Added", vbInformation
'Release Outlook
Set oOutlook = Nothing
End Sub
Comments on this post
No comments have been added for this post.
You must be logged in to make a comment.