Outlook Saving multiple Attachment with Subject Name

  • I got this sample script from Microsoft office website, and it works great in saving attachments from selected e-mail.
    https://gallery.technet.microsoft.co.../Discussions/4


    however, I want to include or have just subject of an e-mail as file name, but not sure how to do about it.


    I have tried declaring following variables

    Code
    1. Dim itm As MailItem
    2. Dim strSubject As String
    3. strSubject = itm.Subject


    and concatenate strsbject on to attachment path.


    Code
    1. strAtmtPath = strFolderPath & atmt.FileName &strSubject


    but, that didn't work.


    any help is greatly appreciated.



  • If you want to replace the file name with the email subject, you can replace these lines:



    with this:


    Rory
    Theory is when you know something, but it doesn’t work. Practice is when something works, but you don’t know why. Programmers combine theory and practice: nothing works and they don’t know why