+ Reply to Thread
Results 1 to 13 of 13

How to save email attachments with subject as a file name

  1. #1
    Forum Contributor
    Join Date
    05-04-2016
    Location
    London
    MS-Off Ver
    MS Office Excel 2010/2013
    Posts
    354

    How to save email attachments with subject as a file name

    Hi all ,

    I have this code brought from (Roni ) website that will save E-mail attachments from my inbox and save it to my local folder as given . however code is doing fine but I wanted code to save my email attachment with email subject . below is the code for your reference .

    Please Login or Register  to view this content.
    appreciate your assistance .
    Last edited by hudson andrew; 02-28-2017 at 01:48 PM. Reason: added code

  2. #2
    Forum Expert
    Join Date
    06-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    1,714

    Re: How to save email attachments with subject as a file name

    Hi
    try changing the file saved name to
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    05-04-2016
    Location
    London
    MS-Off Ver
    MS Office Excel 2010/2013
    Posts
    354

    Re: How to save email attachments with subject as a file name

    Hi all,

    Thanks a lot . but above method gave me error message " Error number = 2147024809".

  4. #4
    Forum Contributor
    Join Date
    05-04-2016
    Location
    London
    MS-Off Ver
    MS Office Excel 2010/2013
    Posts
    354

    Re: How to save email attachments with subject as a file name

    hi can some one please advice . if there is a way we can do this , I have tried various possible ways but no luck .....

  5. #5
    Forum Expert
    Join Date
    06-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    1,714

    Re: How to save email attachments with subject as a file name

    Hi
    ok try this. it's a simpler version so if things go wrong the cause should be easier to spot.

    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    05-04-2016
    Location
    London
    MS-Off Ver
    MS Office Excel 2010/2013
    Posts
    354

    Re: How to save email attachments with subject as a file name

    Hey Nicky,

    thanks Again.. it is very small than my code . however no luck . it is giving me error message " object required" for below line .

    I have one quick question is the below line a selection item, the one I am trying to save with subject name ?.


    " Set MyItem = GetCurrentItem"

  7. #7
    Forum Expert
    Join Date
    06-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    1,714

    Re: How to save email attachments with subject as a file name

    getcurrentitem refers to the email with the attachments. the macro should save the attachments with a name that is the subject of that email, rather than the name of the attachment.

    To work, you should have the email message with the attachment you want to copy either selected or open. Is that perhaps the problem?

    I have just tried it on a different computer and it worked fine.

  8. #8
    Forum Contributor
    Join Date
    05-04-2016
    Location
    London
    MS-Off Ver
    MS Office Excel 2010/2013
    Posts
    354

    Re: How to save email attachments with subject as a file name

    seems like i am missing something , i have tried once again , nothing happening , however i thought of sharing you some screen shots .. attached are the screen shot for your reference .

    should this be running from excel or outlook ?... I am asking this because it worked for you .
    Attached Images Attached Images

  9. #9
    Forum Contributor
    Join Date
    05-04-2016
    Location
    London
    MS-Off Ver
    MS Office Excel 2010/2013
    Posts
    354

    Re: How to save email attachments with subject as a file name

    Hey Nicky , I just realized does above code recognize PDF or any other ?. because i wanted above code to recognize PDF and save with subject name .

    also let me know if i need to check any other references apart from " Microsoft office outlook object 14".

  10. #10
    Forum Expert
    Join Date
    06-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    1,714

    Re: How to save email attachments with subject as a file name

    Hi
    the code should work with PDFs
    try with these references checked:
    • visual basic for applications
    • Microsoft outlook
    • Microsoft office

  11. #11
    Forum Contributor
    Join Date
    05-04-2016
    Location
    London
    MS-Off Ver
    MS Office Excel 2010/2013
    Posts
    354

    Re: How to save email attachments with subject as a file name

    Yes , I have above checked . but still same error ... I wonder how it worked with you ..

  12. #12
    Forum Expert
    Join Date
    06-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    1,714

    Re: How to save email attachments with subject as a file name

    are you in an outlook folder with a mail item selected that has attachments?
    If so, the only thing I can think of is that it is not specifying that MyItem is a mail item.

    try changing

    Please Login or Register  to view this content.


    to

    Please Login or Register  to view this content.

  13. #13
    Forum Contributor
    Join Date
    05-04-2016
    Location
    London
    MS-Off Ver
    MS Office Excel 2010/2013
    Posts
    354

    Re: How to save email attachments with subject as a file name

    are you in an outlook folder with a mail item selected that has attachments? " yes I am ."

    I tried changing it , another failure it did not work .. Nicky are you sure it worked with you ?.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Save outlook attachment as file using email subject as file name w/o invalid characters
    By kristinlarmer in forum Outlook Formatting & Functions
    Replies: 1
    Last Post: 10-16-2015, 05:07 PM
  2. Save outlook attachments and rename/append files with identifier from subject line
    By XLnExcel in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-18-2015, 12:49 PM
  3. Extracting Attachments from outlook based on subject title /file name and between a date
    By himynameisiain in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-14-2013, 02:14 PM
  4. Replies: 0
    Last Post: 08-14-2013, 04:26 PM
  5. Replies: 0
    Last Post: 02-21-2013, 04:46 AM
  6. save email attachments from incoming mail
    By mcinnes01 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-07-2011, 08:00 AM
  7. Trying to save mail attachments with the mail subject as the filename
    By thereth in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-09-2010, 05:31 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1