We are using this script to automatically save the outlook attachment to a required destinations. Our marketing teams started to compliant about one issue where the VBA script over write the file with the same names.
Please check the below VBA script at present we are using:
Public Sub SaveAutoAttach(item As Outlook.MailItem) Dim object_attachment As Outlook.Attachment Dim saveFolder As String ' Folder location when I want to save my file saveFolder = "D:\Data\Archive" For Each object_attachment In item.Attachments ' Criteria to save .doc files only If InStr(object_attachment.DisplayName, ".doc") Then object_attachment.SaveAsFile saveFolder & "\" & object_attachment.DisplayName End If Next End Sub
How could I modify it to not overwrite if the files existing with the same name?