Setting userdefined keywords type field in VBA?

  • Thread starter Thread starter Rogoflap
  • Start date Start date
R

Rogoflap

How do you set a userdefined Keywords type fields value?

I have a contact form with several userdefined keywords
type fields and would like to progromatically change
them, but I can't figure out how to set the value.

I get type mismatch errors when trying to set it to a
string.


Thanks,

Rog
 
Sue,

If you are referring to this article

http://support.microsoft.com/?kbid=201099

This refers to VBScript. I tried to translate it to VBA
code or VB code in my case.

I set omsg.fields("KeywordsType1") = omsg.fields
("TextType").

I still get a type mismatch error.

Exchange 2000 and outlook 2000. VB program.

Thanks,

Rog
 
That's the correct article. The same techniques are available in VBA or VB.

Where is your Fields collection coming from?
--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Sue,

I have it as
Dim oMsg as Outlook.ContactItem

omsg.fields("KeywordsType1") = omsg.fields("TextType")

Should it be a Outlook.Message?

Thanks for your advice?

Rog
 
Neither. Outlook items have no Fields collection. Perhaps you were thinking
of CDO. Since none of the suggested techniques in the article you referred
to use a Fields collection, I don't know where you're coming from with this.
 
Sue,

My mistake. I now see that the example was even more
generic than what I was showing in my problem. I will
now just use the categories field and make my changes by
doing the following...

dim oContact as Outlook.Contactitem
sTempCategories = ocontact.categories
ocontact.categories = "A,B,C,D"
ocontact.Userproperties("KeywordsField") =
ocontact.categories
ocontact.categories = sTempCategories
ocontact.save.

This should work.

Rog
 
Back
Top