Setting userdefined keywords type field in VBA?

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
 
R

Rogoflap

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
 
S

Sue Mosher [MVP]

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
 
R

Rogoflap

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
 
S

Sue Mosher [MVP]

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.
 
R

Rogoflap

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
 

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