I tried to set a rules in outlook 2013 version, but unfortunately i found the run a script option in the action pane, but while clicking on the script underlined one can't able to find My Macro Name to proceed with the rules. Could you please suggest me what will be the issues in that?
What script are you using? The name line needs to be formatted correctly - with the object in the (), not in a dim statement. (You also won't set the object in the macro - you don't use anything like set item = objApp.ActiveExplorer.Selection.Item(1) - the rule sets the item to the newly arrived item.
Thanks for the reply Diane. Below is the script which am trying to execute, please find that and let me know any issues.
Public Sub Application_NewMail()
Dim olapp As Object
Dim olmapi As Object
Dim olmail As Object
Dim olitem As Object
Dim objMyInbox As Object
Dim lrow As Integer
Dim olattach As Object
Dim str As String
Dim chckSubject As Integer
Dim valSubject As String
Dim olp As Object
Dim i As Integer
Const num As Integer = 6
Const path As String = "XXXXXXXXXX"
Const emailpath As String = "XXXXXXXXXXXX"
Const olFolderInbox As Integer = 6
Set olp = CreateObject("outlook.application")
Set olmapi = olp.GetNamespace("MAPI")
Set olmail = olmapi.GetDefaultFolder(num)
Set objMyInbox = olmapi.GetDefaultFolder(olFolderInbox)
If olmail.Items.Restrict("[UNREAD]=True").Count = 0 Then
MsgBox ("No Unread mails")
For i = 1 To olmail.UnReadItemCount
For Each olitem In olmail.Items.Restrict("[UNREAD]=True")
valSubject = olitem.Subject
If valSubject Like ("*XXXXXXXXXX*") And olitem.Attachments.Count <> 0 Then
Sorry, I didn't get a chance to look at this. This Is not a run a script rule - it applies to new mail: Application_NewMail . What are you trying to do with it ? If you want to save attachments on certain messages as they arrive, see