![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
Can't seem to get this to work... or get my head round the methods/properties
to get it right... I've tried using the Object Explorer and even installed OutlookSpy but being a relative beginner with no formal training in Object Orientated Code I'm just getting a headache !! Can anyone help put me on the straight & narrow... it would be much appreciated - thanks Dim colRules As Outlook.Rules Dim oRule As Outlook.Rule Dim colRuleActions As Outlook.RuleActions Dim oFromCondition As Outlook.ToOrFromRuleCondition Dim oCategoryCondition As Outlook.CategoryRuleCondition Dim oInbox As Outlook.Folder Dim oMoveTarget As Outlook.Folder Set oInbox = Application.Session.GetDefaultFolder(olFolderInbox ) Set oMoveTarget = oInbox.Folders(Foldername) Set colRules = Application.Session.DefaultStore.GetRules() Set oRule = colRules.Create(Rulename, olRuleReceive) Set oCategoryCondition = oRule.Conditions.Category With oCategoryCondition.Categories .Categories.Add (CategoryName) End With oRule.Enabled = False colRules.Save All works fine if I comment out the category condition code - rule gets setup but as soon as I throw the category condition in ie. Set oCategoryCondition = oRule.Conditions.Category With oCategoryCondition.Categories .Categories.Add (CategoryName) End With it fails... Any help appreciated - thx |
Ads |
#2
|
|||
|
|||
![]()
oCategoryCondition.Categories takes/returns a string array, it's not a
collection. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "Jabba1963" wrote in message ... Can't seem to get this to work... or get my head round the methods/properties to get it right... I've tried using the Object Explorer and even installed OutlookSpy but being a relative beginner with no formal training in Object Orientated Code I'm just getting a headache !! Can anyone help put me on the straight & narrow... it would be much appreciated - thanks Dim colRules As Outlook.Rules Dim oRule As Outlook.Rule Dim colRuleActions As Outlook.RuleActions Dim oFromCondition As Outlook.ToOrFromRuleCondition Dim oCategoryCondition As Outlook.CategoryRuleCondition Dim oInbox As Outlook.Folder Dim oMoveTarget As Outlook.Folder Set oInbox = Application.Session.GetDefaultFolder(olFolderInbox ) Set oMoveTarget = oInbox.Folders(Foldername) Set colRules = Application.Session.DefaultStore.GetRules() Set oRule = colRules.Create(Rulename, olRuleReceive) Set oCategoryCondition = oRule.Conditions.Category With oCategoryCondition.Categories .Categories.Add (CategoryName) End With oRule.Enabled = False colRules.Save All works fine if I comment out the category condition code - rule gets setup but as soon as I throw the category condition in ie. Set oCategoryCondition = oRule.Conditions.Category With oCategoryCondition.Categories .Categories.Add (CategoryName) End With it fails... Any help appreciated - thx |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Outlook 2003/2007 Rule and Conditions for InBox VBA customization | GreyCoderII | Add-ins for Outlook | 3 | March 23rd 09 09:35 PM |
Send response based on category rule; auto remove category? | tish | Outlook and VBA | 3 | October 31st 08 08:04 PM |
Custom Rule that Opens Incoming Message Meeting Conditions | Chris Dunbar | Outlook and VBA | 2 | October 15th 08 02:55 PM |
Setting reminders by rule or category in Outlook 2003? | hmjarvis | Outlook - Calandaring | 0 | June 21st 06 07:18 AM |
Message rule query | mikey | Outlook Express | 6 | April 11th 06 08:12 PM |