VB icon

Add Contacts from Access 2k to outlook 2k

Email
Submitted on: 1/18/2015 10:54:00 AM
By: John Pope (from psc cd)  
Level: Intermediate
User Rating: By 6 Users
Compatibility: VBA MS Access
Views: 1768
 
     This code will send customer information such as Name address , city, state, zip to outlook2 contacts
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
'**************************************
' Name: Add Contacts from Access 2k to outlook 2k
' Description:This code will send customer information such as Name address , city, state, zip to outlook2 contacts
' By: John Pope (from psc cd)
'
' Assumes:You will need to set the references to use the Outlook 9.0 Object library.
'**************************************

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


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.