Creating a new contact in outlook using vb 6

 
This article demonstrates how to create an contact in outlook programmatically using visual basic 6.0 through Microsoft Outlook’s object-model.

This example requires a button control in Standard EXE project in visual basic 6.0, you need an early-bound reference to a Microsoft Outlook type library. Double-click the button, and then add the following code:

Dim oApp As Outlook.Application
Set oApp = CreateObject(“Outlook.Application”)

Dim oNs As Outlook.NameSpace
Set oNs = olApp.GetNamespace(“MAPI”)
oNs.Logon

Dim oConItem As Outlook.ContactItem
Set oConItem = olApp.CreateItem(olContactItem)

With oConItem
.FullName = “Ankur Gupta”
.Birthday = “2/7/1983
.CompanyName = “PSPL”
.Email1Address = “[email protected]
.HomeAddress = “Noida”
End oConItem

olItem.Save

Set oNs = Nothing
Set oConItem = Nothing
Set oApp = Nothing