Adding a New Outlook Contact (via Automation):
Return to List
' This example illustrates how you can add a new Contact to the Microsoft Outlook Contacts folder. The manner in which you can create new ContactItems is similar to the manner in which you create new AppointmentItems and MailItems, as previously illustrated:
Public Sub AddContact()
Dim objOutlook As New Outlook.Application
Dim objContact As ContactItem
Set objContact = objOutlook.CreateItem(olContactItem)
With objContact
.FirstName = "John"
.LastName = "Doe"
.HomeTelephoneNumber = "123-456-7890"
.HomeAddressStreet = "123 Main St."' Street for the Home .HomeAddressCity = "Anycity"' City for the Home .HomeAddressState = "WA"' State for the Home .HomeAddressPostalCode = "98765"' Postal Code for the Home .Save' Save the new contact End With
Set objContact = Nothing
Set objOutlook = Nothing
End Sub