How to save Outlook attachment in a drive with a new name and overwrite if it already exists?
0
votes
1
answer
622
views
I am using below VBA script to download attachments from email and save it to my windows directory.
I need help to modify this script - 1) to save rename the attachment before saving it 2) Overwrite the file if it already exists. Kindly help.
Public Sub SaveAttachmentsToDisk(MItem As Outlook.MailItem)
Dim oAttachment As Outlook.Attachment
Dim sSaveFolder As String
sSaveFolder = "F:\RBL Attachments\"
For Each oAttachment In MItem.Attachments
oAttachment.SaveAsFile sSaveFolder & oAttachment.DisplayName
Next
End Sub
Asked by Andleeb Hasan
(19 rep)
Oct 6, 2020, 12:36 PM
Last activity: Oct 6, 2020, 12:51 PM
Last activity: Oct 6, 2020, 12:51 PM