i am new to outlook vba. Trying to write a macro script to reply to specific email with specific subject.<br><br>Please find my code below. dont know what am missing out

Sub GioleeRule()


Dim colStores As Outlook.Stores

Dim oStore As Outlook.Store

Dim oRoot As Outlook.Folder

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 oConditionSubject As Outlook.TextRuleCondition

Dim oInbox As Outlook.Folder


Dim oReplyAll As MailItem



'Specify target folder for rule move action

Set oInbox = Application.Session.GetDefaultFolder(olFolderInbox)


'Get Rules from Session.DefaultStore object

On Error Resume Next

Set colStores = Application.Session.Stores

For Each oStore In colStores

Set oRoot = oStore.GetRootFolder

Debug.Print (oRoot.FolderPath)

Next


Set colRules = Application.Session.DefaultStore.GetRules()

'Create the rule by adding a Receive Rule to Rules collection

Set oRule = colRules.Create("dumexy's rule", olRuleReceive)


'Specify the condition in a ToOrFromRuleCondition object

'Condition is if the message is sent by "email"

Set oFromCondition = oRule.Conditions.From

With oFromCondition

.Enabled = True

.Recipients.Add ("email")

.Recipients.ResolveAll

End With


'Specify the condition for the subject in a TextRuleCondition object

'condition is if the subject contains "fun" or "chat"

Set oConditionSubject = oRule.Conditions.Subject


oRule.Conditon.Subject

With oConditionSubject

.Enabled = True

.Text = Array("fun", "chat")

End With

With oReplyAll
'Type Your Own Auto Reply
'Change "My Name" to Your Own Name
.Body = "Yes." & vbCrLf & vbCrLf & "-------Original Message-------" & vbCrLf & "From: " & Item.Sender & "[mailto: " & Item.SenderEmailAddress & "]" & vbCrLf & "Sent: " & Item.ReceivedTime & vbCrLf & "To: YourName" & vbCrLf & "Subject: " & Item.Subject & vbCrLf & Item.Body
.Send
End With

'Update the server and display progress dialog

colRules.Save

End Sub