I try to assign category based on subject in appointment (code included)

P

PGT

Below i wrote code to assign a categorie to a calendar item based on the word "vrij" in the subject
I think this code should work.. but somehow it doesn
I use Outlook 2003 with macro security set to lowest level. The code is placed in "this outlook session
Any ideas why it doesnt work ?

===================================================

Dim WithEvents colRDVItems As Item

Private Sub Application_Startup(
Dim NS As Outlook.NameSpac
Set NS = Application.GetNamespace("MAPI"
Set colRDVItems = NS.GetDefaultFolder(olFolderCalendar).Item
Set NS = Nothin
End Su

Private Sub colRDVItems_ItemAdd(ByVal Item As Object

If Item.Class = olAppointment The
If InStr(LCase(Item.Subject), "vrij") > 1 The
AddCat Item, "Holiday
Item.Sav
End I
End I
End Sub
 
D

Diane Poremsky [MVP]

The programming group is 'down the hall' at microsoft.public.program_vba.
http://www.microsoft.com/office/com...soft.public.outlook.program_vba&lang=en&cr=US

Is there a reason you are using VBA instead of rules?

--
Diane Poremsky [MVP - Outlook]

Outlook & Exchange Solutions Center: http://www.slipstick.com/

Outlook Tips by email:
mailto:[email protected]

EMO - a weekly newsletter about Outlook and Exchange:
mailto:[email protected]

Poll: What version of Outlook do you use?
http://forums.slipstick.com/showthread.php?t=27072
 
P

PGT

yes i got to automate it with many keywords
and it has to be done for a lot of people, keeping it in code should simply this

so shown above "vrij" is just one keyword but, if this works then next i can add all other words and i can automate more, its part of something bigger.
 

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