Hi, I am running this script along with a rule. When an email is received from a specified person and it contains an attachment, it will run the script. The script saves a copy of the attachment and renames it as the subject. The format of the attachment received in the email is in .XLS format and I want to keep that format. The script is saving the file to my path and renaming it as the subject but I can't open the file, I get "the file format and extension of file name don't match. The file could be corrupt or unsafe"
Can anyone help me?
Sub saveAttachtoDisk(itm As Outlook.MailItem)
Dim objAtt As Outlook.Attachment
Dim saveFolder As String
saveFolder = "Y:\accounts\success fee bills"
For Each objAtt In itm.Attachments
objAtt.SaveAsFile saveFolder & "" & itm.Subject & ".XLS"
Set objAtt = Nothing
Next
End Sub