VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Add Contacts from Access 2k to outlook 2k

by John Pope (1 Submission)
Category: Microsoft Office Apps/VBA
Compatability: Visual Basic 3.0
Difficulty: Intermediate
Date Added: Wed 3rd February 2021
Rating: (6 Votes)

This code will send customer information such as Name address , city, state, zip to outlook2 contacts

Assumes
You will need to set the references to use the Outlook 9.0 Object library.

Rate Add Contacts from Access 2k to outlook 2k

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

Download this snippet    Add to My Saved Code

Add Contacts from Access 2k to outlook 2k Comments

No comments have been posted about Add Contacts from Access 2k to outlook 2k. Why not be the first to post a comment about Add Contacts from Access 2k to outlook 2k.

Post your comment

Subject:
Message:
0/1000 characters