I had been using Outlook rules to run a script if the subject contains "My Calls" to save an Excel file.
Since an update I can no longer use the "run a script" option of Outlook's rules. I haven't managed to work out the VBA to check all emails for My Calls in the subject to then run the script.
Private Sub SaveAttachments(Item As Outlook.MailItem)
If Item.Attachments.Count > 0 Then
Dim EmAttach As Outlook.Attachments
Dim AttachCount As Long
Dim EmAttFile As String
Dim sFileType As String
Dim i As Long
Set EmAttach = Item.Attachments AttachCount = EmAttach.Count
For i = AttachCount To 1 Step -1
'Get the file name.
EmAttFile = EmAttach.Item(i).FileName
If LCase(Right(EmAttFile, 5)) = ".xlsx" Then
'Get the path to your My Documents folder
DestFolderPath = CreateObject("WScript.Shell").SpecialFolders(16) DestFolderPath = DestFolderPath & "\Attachments"
'Combine with the path to the folder.
EmAttFile = DestFolderPath & EmAttFile
'Save the attachment as a file.
EmAttach.Item(i).SaveAsFile EmAttFile
End If
Next i
End If
End Sub
I need this code to work automatically. I receive 35+ spreadsheets with a list of calls that an agent has completed. These have to be saved in a fixed location (they don't have access to) so another sheet can extract the data into a dashboard.