Creating rule to create week folder and transfer mail using alert

Status
Not open for further replies.

ASIF

New Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server 2010
1) I wanted to create a rule which will create "BLUE-July 20 - 26" sub-folder under SKY folder on every Sunday 1 AM . This should be created everyweek Sunday.
2) I want mails to transfer to the above folder to the week they belong to as soon as they arrive to inbox .

Please help me as i am a newbie.

Regards,
Asif
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
I'm not sure a run a script rule is the best option - it will get complicated doing the date calculations. On the other hand, it's easy to edit manually every week - but that's manual.

I'd probably use a script that is triggered by a reminder to create the new folder and delete / create a rule that uses the new folder.

This creates the folder and sets the rule.

Code:
Sub CreateFolderRule()
Dim colRules As Outlook.Rules
Dim oRule As Outlook.Rule
Dim colRuleActions As Outlook.RuleActions
Dim oMoveRuleAction As Outlook.MoveOrCopyRuleAction
Dim oFromCondition As Outlook.ToOrFromRuleCondition
Dim oExceptSubject As Outlook.TextRuleCondition
Dim oFolder As Outlook.Folder
Dim oMoveTarget As Outlook.Folder

Dim BlueDate As String

BlueDate = "Blue " & Format(Date, "MMMM dd") & "-" & Format(Date + 7, "dd")
Debug.Print BlueDate

Set oFolder = Application.Session.GetDefaultFolder(olFolderInbox)
Set oFolder = Session.GetDefaultFolder(olFolderInbox).Parent.Folders("Sky")
On Error Resume Next
Set oMoveTarget = oFolder.Folders(BlueDate)
If oMoveTarget Is Nothing Then
    Set oMoveTarget = oFolder.Folders.Add(BlueDate)
       End If
Set colRules = Application.Session.DefaultStore.GetRules()

Set oMoveRuleAction = oRule.Actions.MoveToFolder
With oMoveRuleAction
.Enabled = True
.Folder = oMoveTarget
End With

colRules.Save
End Sub
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
Liza Creating a rule in outlook to filter messages Using Outlook 0
A Creating an outlook rule to forward an email with a specific message Using Outlook 1
J Outlook creating unwanted rule on its own Using Outlook 1
A Creating a rule on “Deleted items” folder Using Outlook 1
A Creating archive rule on the clients by script/ Outlook VBA and Custom Forms 3
S Creating custom rule to move if "NAME" is in body but ignore the phrase "Hi NAME" in the search Using Outlook 2
G Creating an Outlook Rule using Internet Header time Using Outlook 1
A Creating a rule that both forwards the original attachment and uses a template Using Outlook 11
L Creating Custom Rule to Forward emails to a BCC Using Outlook 1
S Question about creating a rule Using Outlook 1
Fozzie Bear Outlook 2016 Creating a shared local Contacts folder Using Outlook 2
R Creating a user defined function Outlook VBA and Custom Forms 3
M Creating an RSS Feed **FROM** Outlook 2013 Calendar. Using Outlook 5
O How to prevent CC from showing when creating a new mail? Using Outlook 1
N Creating a button or link to a form in the Organizational Forms Library Outlook VBA and Custom Forms 3
B Creating an email with the list of tasks Outlook VBA and Custom Forms 0
L Creating drafts when I thought I was sending Using Outlook 1
R Would creating a new profile cause Outlook to download all the old mails from the server? Using Outlook 1
A Creating Progress Bar or Status Bar Update Outlook VBA and Custom Forms 0
T Outlook creating a folder named: "Unwanted" Using Outlook 3
M Outlook 2007 Contacts Glitch: Creating a new email Using Outlook 1
A Are categories still recommended for creating local distribution lists? Using Outlook 3
S Creating Email - Selecting Pre-Defined Text Using Outlook 2
D Creating an outlook session from Access vba but run silently. With A specific profile Outlook VBA and Custom Forms 1
M Creating Outlook Appointments from Excel Cells Outlook VBA and Custom Forms 1
N Creating New Profile Using Outlook 0
Y Creating custom appointment request form with multiple mail recipients Outlook VBA and Custom Forms 5
M creating email from contact file = 3 emails in To field Using Outlook 3
P Recover / Extract Rules from standalone PST file creating RWZ file Using Outlook 2
I Creating meeting invite with disabled tentative button Outlook VBA and Custom Forms 5
E Creating email templates for organizational use Using Outlook 0
N Creating or changing the main new mail message template in Outlook 2010 Using Outlook 2
D Creating custom view with VBA Outlook VBA and Custom Forms 2
R Creating a Room Mailbox with Exchange Online Outlook VBA and Custom Forms 0
CMG73 Creating templates with predefined subject and CC Using Outlook 1
G Creating Contact Sub Folders Using Outlook 2
Rupert Dragwater creating gmail account in Outlook 2013 Using Outlook 7
nathandavies Creating a Select Case for a directory of folders Outlook VBA and Custom Forms 1
2 creating custom stationery Using Outlook 2
A Help creating macro for conditional formatting settings Using Outlook 8
Fozzie Bear Creating Custom Meeting Form Outlook VBA and Custom Forms 6
U Creating a (This computer only) folder within an IMAP account directory Using Outlook 1
J Creating a URL from a message body excerpt before forwarding Using Outlook 2
B Need Help Creating Email Based on Subject w Address in Body Outlook VBA and Custom Forms 1
J Creating an "isolated" shared calendar in Outlook Outlook VBA and Custom Forms 1
L Creating a Task from Email and Attaching Original Email Outlook VBA and Custom Forms 6
witzker Outlook bug when creating a user defined contact form? Using Outlook 1
Wotme Creating a Outlook task in Excel Using Outlook 7
V Need to add some text in subject while creating new mails - NEED VB CODINGS Using Outlook 4
G Questions on creating Outlook forms Using Outlook 0

Similar threads

Top