Save attachments using hotkey without changing attributes

ofw62

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Current method:
open mail
select attachment(s)
save to
select folder
[OK]
close mail
next one ..

the date attributes of the files saved that in that way are updated to the date of saving (create/modified/access date)

Would there be a way to have these files saved
a. without having to open the mails on by one
b. preserve the original attributes, at least the creation date.

No doubt there are 3rd party tools (like EzDetach, payware) but I wonder whether there would be a native solution
or using a free script?

Office 365

I have noticed:
1. Article : Save and Rename Outlook Email Attachments with 3 scripts and many comments
first requiring
2. A registry patch outlined in Run-a-Script Rules Missing in Outlook

Now, after changing the registry, which script should I use?
I would like to have the name and then the created date added.
So, for example, file name reads: file-xyz.xlsx
the save as : file-xyz ddmmyyyy.xlsx (or file-xyz dd-mm-yyyy.xlsx)

Is this possible?

Thanks!
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
I would use the middle one - the run a script rule version. The first is manual, the last increments identical file names.

Adjusting the saved file name to meet your needs is generally easy enough
Code:
DateFormat = Format(Date, "yyyy-mm-dd ")

file = saveFolder & DateFormat & objAtt.DisplayName
Gives "date filename.ext" format. to do filename-date.ext format, you need to get the extension stick the date in before it.

you can use something like this from the first macro - it's actually better to get the position of the last dot then get the extension, unless you are only looking for specific file extensions.

Code:
For Each objAtt In itm.Attachments

' get the last 5 characters for the file extension
strExt = Right(objAtt.DisplayName, 4)

' clean the subject
strSubject = itm.Subject

ReplaceCharsForFileName strSubject, "-"
' put the name and extension together

file = saveFolder & strSubject & strExt
From another macro on the site - this would only save the ones that match the extensions.
Code:
' This code looks at the last 4 characters in a filename
      sFileType = LCase$(right$(objAtt.FileName, 4))

      Select Case sFileType

' Add additional file types below
      Case ".xls", ".doc", "docx"
 
Top