Hey guys, i've gotta problem here and was wondering if theres any other VB Gurus here.
What I am trying to do is, have a VB app read contacts from a .csv file, and import them into Outlook 2000. I can get this to happen...but what i'm having trouble on is having them add to a specific contact folder (address list) in outlook. When the below code is executed, it simply adds it to the root 'Contact' folder....Below is the code I have so far:
Dim ol As Outlook.Application
Dim ns As Outlook.NameSpace
Dim fl As Outlook.Folders
Dim itmContact As Outlook.ContactItem
' grab Outlook
Set ol = New Outlook.Application
' get MAPI reference
Set ns = ol.GetNamespace("MAPI")
' Create new Contact item
Set itmContact = ol.CreateItem(olContactItem)
' Setup Contact information...
With itmContact
.FullName = "James Smith"
.Anniversary = "09/15/1997"
' saving b-day info creates info in the calendar
.Birthday = "9/15/1975"
.CompanyName = "Microsoft"
.HomeTelephoneNumber = "704-555-8888"
.Email1Address = "someone@microsoft.com"
.JobTitle = "Developer"
.HomeAddress = "111 Main St." & vbCr & "Charlotte, NC 28226"
End With
' Save Contact...
itmContact.Save
Set ol = Nothing
Set ns = Nothing
Set itmContact = Nothing
MsgBox "Done.
What I am trying to do is, have a VB app read contacts from a .csv file, and import them into Outlook 2000. I can get this to happen...but what i'm having trouble on is having them add to a specific contact folder (address list) in outlook. When the below code is executed, it simply adds it to the root 'Contact' folder....Below is the code I have so far:
Dim ol As Outlook.Application
Dim ns As Outlook.NameSpace
Dim fl As Outlook.Folders
Dim itmContact As Outlook.ContactItem
' grab Outlook
Set ol = New Outlook.Application
' get MAPI reference
Set ns = ol.GetNamespace("MAPI")
' Create new Contact item
Set itmContact = ol.CreateItem(olContactItem)
' Setup Contact information...
With itmContact
.FullName = "James Smith"
.Anniversary = "09/15/1997"
' saving b-day info creates info in the calendar
.Birthday = "9/15/1975"
.CompanyName = "Microsoft"
.HomeTelephoneNumber = "704-555-8888"
.Email1Address = "someone@microsoft.com"
.JobTitle = "Developer"
.HomeAddress = "111 Main St." & vbCr & "Charlotte, NC 28226"
End With
' Save Contact...
itmContact.Save
Set ol = Nothing
Set ns = Nothing
Set itmContact = Nothing
MsgBox "Done.