+ Reply to Thread
Results 1 to 5 of 5

Setting a dynamic file list in array to be added as mail attachments

  1. #1
    Registered User
    Join Date
    03-08-2010
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    2

    Setting a dynamic file list in array to be added as mail attachments

    Hi

    I have just scratched the surface of arrays in Excel and got stuck at setting up the dynamically occuring file links, which should be added to Outlook e-mail as attachments.

    I am at first checking many hundreds of rows of data. In a certain row all cells are already sorted from A-Z, so there may be several equal values - some occuring only once, other two times or more. Every different value is defined as fixed range in first level loop. In second level loop I am trying to set up a dynamic list of local file links, to be used as attachments in Outlook mail by using an array. Current code gives me result, as can be seen in an immediate window:
    D:\TEMP\File1.pdf
    D:\TEMP\File2.pdf
    D:\TEMP\File3.pdf
    D:\TEMP\File4.pdf

    So links are succesfully added dynamically to the array list, but I cannot figure it out how to use these for file attachmenst in an Outlook email. Any help greatly appreciated!

    My current code:
    Please Login or Register  to view this content.
    THANK YOU!

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Setting a dynamic file list in array to be added as mail attachments

    Add them as attachments in a loop like you did when you printed them to the immediate window.

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Setting a dynamic file list in array to be added as mail attachments

    On another note; the .Find method "remembers" the last settings used for each argument. In the code below, you specify the search direction in the second instance of the .Find command, but not in the first. That means in the next loop, the first instance will also use the xlPrevious direction. I don't think you want that. I suggest to explicitly set all the relevant arguments for the Find command in each instance just to be safe.

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    03-08-2010
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Setting a dynamic file list in array to be added as mail attachments

    Hi

    For the part ".Attachments" I get an error "Compile error: Invalid or unqualified reference"
    Please Login or Register  to view this content.
    I would kindly ask you for another run, thank you

  5. #5
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Setting a dynamic file list in array to be added as mail attachments

    Do you put the code in the right place?

    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. Icons for attachments added via VBA
    By Nick-B in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-09-2019, 05:38 AM
  2. Help setting up a dynamic top 10 list?
    By sophruand in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 08-26-2015, 06:19 PM
  3. Attachments in Mail
    By shyam sundar in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-25-2013, 04:48 PM
  4. macro to create file for every new record added to the list
    By jarssonn in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-18-2010, 05:10 AM
  5. 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
  6. Creating TWO-WAY E-Mail Attachments with 'BeforeSave Events' in Code for 2nd E-Mail
    By Chuckles123 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-08-2005, 12:56 PM
  7. E-mail Attachments
    By STEVEB in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-23-2005, 11:28 AM

Tags for this Thread

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