Outlook VBA Alogos - abdullahbintahir/Python-Snippet GitHub Wiki
Save attachments of the selected emails
Sub DownloadAttachmentsFromSelectedEmails()
Dim selectedItems As Selection
Dim mailItem As Object
Dim attachment As Object
Dim savePath As String
' Set the folder where you want to save the attachments
savePath = "C:\Users\moxtahir\OneDrive - Deloitte (O365D)\Desktop\DTIT new\"
' Get the currently selected items in Outlook
Set selectedItems = Application.ActiveExplorer.Selection
' Loop through each selected email
For Each mailItem In selectedItems
' Loop through attachments and save to specified folder
For Each attachment In mailItem.Attachments
' Save all attachments regardless of file type
attachment.SaveAsFile savePath & attachment.FileName
Next attachment
Next mailItem
End Sub