WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

OLE and Outlook
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Adding Contact Information into Outlook

 Keywords: contact information create add 

Question:

Does anyone have some code for adding contacts into the contact list in Outlook 2000? I have looked in Tech support, but can only find information regarding exporting data into XML format or an excel spreadsheet. I am looking to scan an excel spreadsheet containing updated contact information, and then check if contact exists, update it or if it does not exist, create it.

Answer:

You'll have to come up with your own code to search thru contacts to see if one is already there. But this should get you started.
olContactItem = 2
objOutlook = objectopen("Outlook.Application")

newContact = objOutlook.createItem(olContactItem)

;' Set some properties for the contact
newContact.FirstName = "Joe"
newContact.LastName = "Blow"
newContact.BusinessAddress = "One Microsoft Way"
newContact.BusinessAddressCity = "Redmond"
newContact.BusinessAddressState = "WA"
newContact.Email1Address = "JoeBlow@microsoft.com"
newContact.BusinessTelephoneNumber = "425-882-8080"
;   save it...
newContact.save

objectclose(newContact)
objectclose(objOutlook)

exit

Article ID:   W15612
File Created: 2003:05:13:11:29:14
Last Updated: 2003:05:13:11:29:14