Link to home
Start Free TrialLog in
Avatar of bvallanc
bvallancFlag for United States of America

asked on

Outlook 2007 VBA Syntax To Change The Value Of A Contact Property

I have been struggling for three hours trying to find the syntax to change the value of a user-defirned field on a custom contact form.  I am able to read the value of the field with the following syntax:

Dim objNS As Outlook.NameSpace
Dim objContactsFldr As Outlook.Folder
Dim objContactItems As Outlook.Items
Dim objContact As Outlook.ContactItem

Set objNS = Application.GetNamespace("MAPI")
Set objContactsFldr = objNS.GetDefaultFolder(olFolderContacts)
Set objContactItems = objContactsFldr.Items.Restrict("[MessageClass = 'IPM.Contact.LeadGen1_1'")

'This reads perfectly
Debug.Print objContact.UserProperties.Find("CallTask1").Value

'But this fails with Error 242 - Object required ...
Set objContact.UserProperties.Find("CallTask1").Value = True

Open in new window

I can't figure out what I'm doing wrong.  I can't find anything by Googling.  Is this a black art or something?

Thanks,

Bill Vallance
ASKER CERTIFIED SOLUTION
Avatar of bvallanc
bvallanc
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial