You can run a script from a rule that identifies the incoming messages. The following script will extract the chosen attachment (here any Excel worksheet, but you can change the extension as required). The messages are saved at the location defined in strPath (don't forget the back slash at the end of the path)
The date and time in the format
yyyymmdd-(HHMM) - Filename.ext
are added to the filename. If you just want the time and date edit the string. Watch out for illegal filename characters if changing the date format.
e.g.
20160927-(1428) - Datasheet.xlsx
Code:
Sub CustomSaveAttachments(Item As Outlook.MailItem)
Dim olAtt As Attachment
Dim strFileName As String
Const strPath As String = "C:\Path\" ' The location where the attachment is to be saved
Const strExt As String = "xlsx" ' the filename extension
If Item.Attachments.Count > 0 Then
For Each olAtt In Item.Attachments
'Check the attachment file type by looking at the extension
If olAtt.FileName Like "*" & strExt Then
strFileName = Format(Date, "yyyymmdd-") & "(" & Format(Time, "HHMM) - ") & olAtt.FileName
olAtt.SaveAsFile strPath & strFileName
End If
Next olAtt
End If
lbl_Exit:
Set olAtt = Nothing
Exit Sub
End Sub
You can test the code before implementing it in the rule using the following with a selected message that has the attachment.
Code:
Sub GetMsg()
Dim olMsg As MailItem
On Error Resume Next
Set olMsg = ActiveExplorer.Selection.Item(1)
CustomSaveAttachments olMsg
lbl_Exit:
Exit Sub
End Sub