+ Reply to Thread
Results 1 to 4 of 4

Download Excel email attachment

  1. #1
    Registered User
    Join Date
    08-26-2014
    Location
    London,England
    MS-Off Ver
    2010
    Posts
    95

    Download Excel email attachment

    Hi,

    Is it possible to amend the below code so that when it saves the attachment it changes the file name. Currently it keeps overwriting files instead of creating and renaming new ones.

    It would also be perfect if the code could rename each file based on data in a cell.

    Please Login or Register  to view this content.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,718

    Re: Download Excel email attachment

    The following line in your code specifies the full path name for where the file is to be saved:

    Please Login or Register  to view this content.
    You can make the filename anything you want, just change the part to the right of the "&". If you want the filename to be taken from a cell, such as A1 on Sheet1, using the same extension as the attachment:

    Please Login or Register  to view this content.
    For example, if you have "Test" in A1 and the attachment is "Foo.xlsx" then the result will be "Test.xlsx".

    I have compiled but not tested this since it requires some setup with Outlook specific to your situation.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    08-26-2014
    Location
    London,England
    MS-Off Ver
    2010
    Posts
    95

    Re: Download Excel email attachment

    Thanks for the help. I copied this code, but I get the error 'Invalid procedure call or argument'. Also I changed "A1" to "D4" for my purposes.

    Please Login or Register  to view this content.
    Any ideas?

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,718

    Re: Download Excel email attachment

    My mistake, fname was in my test code and not the correct thing to use in your code. This line will work:

    Please Login or Register  to view this content.

+ 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. olMail - Email Attachment Variable. Sending Email through Excel
    By ShakJames in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-23-2014, 07:55 AM
  2. olMail - Email Attachment Variable. Sending Email through Excel
    By ShakJames in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-23-2014, 07:41 AM
  3. Can't download attachment
    By lordfa9 in forum Suggestions for Improvement
    Replies: 2
    Last Post: 04-02-2014, 08:14 AM
  4. email excel file or worksheet as an attachment to multiple email addresses
    By jgeagle5 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-16-2009, 03:40 PM
  5. attachment - then email from excel!
    By dj_siek in forum Excel General
    Replies: 0
    Last Post: 02-14-2006, 10:10 PM

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