View Single Post
  #2  
Old September 13th 07, 06:25 AM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default Programmatically assigning categories



The event you're looking for is the ItemSend event. Please look into the VBA
help for a sample.

Depending on your needs, you might search for 'netapp' in the item's subject
or body property. For that use the Instr function, which returns a value 0
if the string is found.

Then add a specific category to the item's Categories property. before that,
check if it already contains a value. If so, then add the new value with a
leading semicolon - else you would overwrite the existing category.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Organize eMails:
http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6

Am Wed, 12 Sep 2007 09:56:03 -0700 schrieb Jody:

Can you guys tell me how to implement this?

I have several categories and would like emails that are sent regarding
specific events:

Such as an email sent with the word "Netapp" to automatically be assinged
netapp upgrade category.

How can a programatically setup categories in this manner?

Please include step by step instructions as I am new to outlook

programming
and don't know exactly how to edit the code but, have done similar things

in
thep ast with previous verisons of outlook.

I appreciate the help.



"RobL" wrote:

Well Sue,

you're a genius! I really appreciate your help.

Cheers,
Rob
--
Software Support Engineer
i2 Ltd.


"Sue Mosher [MVP-Outlook]" wrote:

Yes. Unless you save the item, the changes are not permanent.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx


"RobL" wrote in message

...
Hi Sue,

I'm not doing a .Save anywhere in my code. Do you think that

including one
after my category assignment would encourage the explorer to re-group

by
category?

Mit freundlichen Grüßen
Rob

--
Software Support Engineer
i2 Ltd.


"Sue Mosher [MVP-Outlook]" wrote:

Maybe a dumb question, but are you also including an objMail.Save

statement?

"RobL" wrote in message

...
Hello again,

a small update to my problem:

When I assign a Category programmatically (through

objMail.Categories =
"MyCategory" as before), the explorer doesn't catch on to the fact

that the
category has changed until I right-click and do Categories...

The category I assigned programmatically is there in the list and

is ticked,
and it's only when I ok this dialog that the explorer finally

re-organises
itself and the email is grouped by the correct category.

Is there a way to programmatically force this to happen?


"RobL" wrote:

Hi Guys,

Outlook 2003, VBA Code:
I'm programmatically assigning categories to email messages (e.g.
objMail.Categories = "My Category"). All very well, but when I

have my
emails arranged by Category, the location of the email in the

Explorer does
not always match up its Category. Is there a way to refresh the

sort when a
category changes. This area of functionality seems a little

"flakey".

Your help is greatly appreciated.

Rob Levy
--
Software Support Engineer
i2 Ltd.


Ads