Setting contact field value

  • Thread starter Thread starter Jim
  • Start date Start date
J

Jim

I'm using the following code to try to set contact field values:

Set myItem = myFolder.Items.Add
For j = 1 To UBound(myArray, 1)
myItem.myArray(j, 2) = "Mr."
Next j

I get a 438 error, object doesn't support this property

myArray(j,2) is a string value (in this case set to "Title")

Is there some other way to use a variable to hold the names of the Outlook
fields, or do I have to use myItem.Title = "Mr."?

Thanks for your help,
Jim
 
Outlook 2002 added an ItemProperties collection -- myItem.ItemProperties("Title"). On earlier versions, it's myItem.Title.
--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
 
Thanks for your response Sue.
This might work, but I do have a question. I looped through the
IemProperties for a standard contact in Outlook 2003 and returned 154 items.
Will these items change (specifically in different versions). If not I might
be able to use the following line to set the item value:

For j = 1 To UBound(myArray, 1)
myItem.ItemProperties.item(CInt(MyArray(j, 2))).Value = strNewValue
Next 'j

MyArray(j, 2) now is set to "133" for title
See any problems?



Outlook 2002 added an ItemProperties collection --
myItem.ItemProperties("Title"). On earlier versions, it's myItem.Title.
--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
 
I would absolutely expect these to change, not just with different versions but if the item has custom properties, and would use only names, which have to be unique, not index numbers.
--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
 
thanks, I was already re-writing the macro


I would absolutely expect these to change, not just with different versions
but if the item has custom properties, and would use only names, which have
to be unique, not index numbers.
--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
 
Back
Top