View Single Post
  #1  
Old November 29th 06, 10:04 PM posted to microsoft.public.outlook.program_vba
Phyllis Blans
external usenet poster
 
Posts: 1
Default Problem copying User1 data to custom-defined field

Hi all,

Very novice user here. After importing contacts from an Excel file into
Outlook 2003, I have mapped 1 item to User Field 1. I now need to copy
that value into a custom-defined field called "Specialty".

I started out with the code I got from he
http://www.outlookcode.com/d/code/convertfields.htm and modified as
needed (modified code below).

PROBLEM
This is only working on the first record in the list. All subsequent
records remain blank.

CODE
Sub ConvertFields()
Dim objApp As Application
Dim objNS As NameSpace
Dim objFolder As MAPIFolder
Dim objItems As Items
Dim objItem As Object

Set objApp = CreateObject("Outlook.Application")
Set objNS = objApp.GetNamespace("MAPI")
Set objFolder = objNS.PickFolder
If Not objFolder Is Nothing Then
Set objItems = objFolder.Items
For Each objItem In objItems
If objItem.Class = olContact Then
objItem.UserProperties("Specialty") = objItem.User1
objItem.Save
End If
Next
End If

What am I missing? Thanks for any help you can provide.
Phyllis

Ads