This is the code in Outlook that sets the rules in Outlook automatically to save the attachment (Excel) with date stamp:
Public Sub saveAttachtoDisk(itm As Outlook.MailItem)
Dim objAtt As Outlook.Attachment
Dim saveFolder As String
Dim dateFormat
dateFormat = Format(Now, "yyyy-mm-dd H-mm")
saveFolder = "c:\Users\abc1\Desktop\"
For Each objAtt In itm.Attachments
objAtt.SaveAsFile saveFolder & "\" & dateFormat & objAtt.DisplayName
Set objAtt = Nothing
Next
End Sub
Next step I want is to open the attachment once it's saved. Is that possible?
How about this one?
Public Sub saveAttachtoDisk(itm As Outlook.MailItem)
Dim objAtt As Outlook.Attachment
Dim saveFolder As String
Dim dateFormat
dateFormat = Format(Now, "yyyy-mm-dd H-mm")
saveFolder = "c:\Users\abc1\Desktop\"
For Each objAtt In itm.Attachments
objAtt.SaveAsFile saveFolder & "\" & dateFormat & objAtt.DisplayName
Set objAtt = Nothing
Next
Dim Shex As Object
Set Shex = CreateObject("Shell.Application")
tgtfile = "objatt"
Shex.Open (tgtfile)
End Sub