Creating a new item in a custom folder

K

Kelley

I keep my customer information in a contacts folder called Customers
which is a sub folder of my Main Personal Folders, so it's on the same
level as the default Contacts folder. I successfully use VBA to pull
fields out of the Customers folder and to update fields in a Customer
contact item. However, the following code places the new record into
the default Contacts folder instead of the Customers folder.

Can anyone tell me what I'm doing wrong here?'

Using Outlook 2002, the VBA app is a project in Excel 2002.

Thanks,
_________

Option Explicit

Dim olApp As Outlook.Application
Dim olNs As Outlook.NameSpace
Dim Fldr As Outlook.MAPIFolder
Dim olCi As Outlook.ContactItem
Dim olItems As Outlook.Items
Dim custFldr As Outlook.MAPIFolder

Private Sub btnOK_Click()

If txtLast.Value = "" Then
Beep
Else
Set olApp = New Outlook.Application
Set olNs = olApp.GetNamespace("MAPI")
Set Fldr = olNs.Folders(1)
Set custFldr = Fldr.Folders("Customers")
Set olCi = olApp.CreateItem(olContactItem)

With olCi
.LastName = Me.txtLast.Value
.FirstName = Me.txtHusband.Value
.Spouse = Me.txtWife.Value
.MailingAddressStreet = Me.txtStreet.Value
.MailingAddressCity = Me.txtCity.Value
.MailingAddressPostalCode = Me.txtZip.Value
.Save

End With

[LName] = olCi.LastName
[Fname] = olCi.FirstName
[Sname] = olCi.Spouse
[AddrStreet] = olCi.MailingAddressStreet
[AddrCity] = olCi.MailingAddressCity
[AddrZip] = olCi.MailingAddressPostalCode



Unload Me
End If

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top