Error in rule- Run a script

Outlook version
Outlook 2010 64 bit
Email Account
Hi All,

The below macro works great and am triggering this when a email arrives.

but sometimes i get "Error in rule" and rule stops.

Any idea what causing this error ?

Public Sub saveAttachtoDisk(itm As Outlook.MailItem)
Dim objAtt As Outlook.Attachment
Dim saveFolder As String
Dim strFileExtension As String
strFileExtension = ".xlsm"

' Change the below location as you created folder in C drive
saveFolder = "C:\Robo_Emea\Incoming"
     For Each objAtt In itm.Attachments
      If LCase(Right(objAtt.FileName, 5)) = strFileExtension Then
      objAtt.SaveAsFile saveFolder & "\" & objAtt.FileName
          Set objAtt = Nothing
          End If
End Sub

Similar threads