+ Reply to Thread
Results 1 to 13 of 13

Several persons initials in one cell, sent to their respective e-mail addresses.

  1. #1
    Registered User
    Join Date
    09-13-2012
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    11

    Several persons initials in one cell, sent to their respective e-mail addresses.

    I have been using the code below to send e-mails based on dates (props to paul) when the workbook is opened. What I can't figure out to do it to enter several initials into cell i,12 and have their respective e-mail addresses added to the "Strto" Value.

    Example: J.D and D.J are held within an i,12 cell. I would like these to correspond to [email protected] and [email protected].

    Please Login or Register  to view this content.
    Thanks a bunch,

    Lacessit
    Last edited by JosephP; 09-26-2012 at 07:10 AM. Reason: corrected code tags

  2. #2
    Forum Contributor wallyeye's Avatar
    Join Date
    05-06-2011
    Location
    Arizona
    MS-Off Ver
    Office 2010, 2007
    Posts
    308

    Re: Several persons initials in one cell, sent to their respective e-mail addresses.

    You can put the names into an array, then loop through that:

    Please Login or Register  to view this content.
    You will need to define a Named Range "NameMap" that contains a list of your initials and e-mail addresses.

  3. #3
    Registered User
    Join Date
    09-13-2012
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Several persons initials in one cell, sent to their respective e-mail addresses.

    Hi Walleye,

    Thanks for helping It won't let me upload a copy of my sheet here at work but I can do it while at home. It seems the Named range I'm creating isn't working? Gives me a 'Type mismatch' error.

  4. #4
    Registered User
    Join Date
    09-13-2012
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Several persons initials in one cell, sent to their respective e-mail addresses.

    Hi Walleye,

    Thanks for helping It won't let me upload a copy of my sheet here at work but I can do it while at home. It seems the Named range I'm creating isn't working? Gives me a 'Type mismatch' error.
    Managed to upload it using my phone
    Attached Files Attached Files
    Last edited by Lacessit; 09-14-2012 at 03:56 AM.

  5. #5
    Forum Contributor wallyeye's Avatar
    Join Date
    05-06-2011
    Location
    Arizona
    MS-Off Ver
    Office 2010, 2007
    Posts
    308

    Re: Several persons initials in one cell, sent to their respective e-mail addresses.

    I would recommend putting NameMap on a separate worksheet, it needs to be two columns with the first column containing the initials and the second containing the e-mail address.

  6. #6
    Registered User
    Join Date
    09-13-2012
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Several persons initials in one cell, sent to their respective e-mail addresses.

    Hi Walleye,

    I seem to be getting 'Runtime error '-2147221238 (8004010a)' automation error with this line of code?
    I've tried creating a named range on a different sheet like you suggested but to no avail.

    I have it working with one set of initials now, but when I seperate the initials with a "," and try to add another I get Runtime error '-2147221238 (8004010a)' automation error? I can get the error to not come up, but then the second set of initials in the cell still doesn't get an e-mail?

    Please Login or Register  to view this content.
    Last edited by JosephP; 09-26-2012 at 07:11 AM.

  7. #7
    Forum Contributor wallyeye's Avatar
    Join Date
    05-06-2011
    Location
    Arizona
    MS-Off Ver
    Office 2010, 2007
    Posts
    308

    Re: Several persons initials in one cell, sent to their respective e-mail addresses.

    I did find a bit of a logic error, it was creating one e-mail and updating the To line with each new entry. So, I moved the:

    Please Login or Register  to view this content.
    inside the loop.

    Try this attached spreadsheet EmailWithSplit.xls, I've put initials in column L and created a NamedRange on a new EMail worksheet. Note there are no spaces between the initials in column L.

  8. #8
    Registered User
    Join Date
    09-13-2012
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Several persons initials in one cell, sent to their respective e-mail addresses.

    I'm still getting the same error when the initials are grouped as such DD,CJ. When I add a space it doesn't give me the error but doesn't send the e-mail. Any ideas? I ran the attached sheet unedited and still no luck .

    AHA! I've made it work but putting the line of code you specified within the intAddress field like so

    Please Login or Register  to view this content.
    Thanks Walleye you've been a great help. I think this may be solved
    Last edited by JosephP; 09-26-2012 at 07:11 AM.

  9. #9
    Registered User
    Join Date
    09-13-2012
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Several persons initials in one cell, sent to their respective e-mail addresses.

    Hi Walleye,

    I seem to be having a problem with what I believe is this piece of code.

    Please Login or Register  to view this content.
    My problem is that the code works fine for the sample sheet I sent you but with other sheets it will miss initials and not send e-mails at the end (these sheets have more rows and more dates)

    Example: judging by the initials it should be sending 11 e-mails but is only sending 9 - ending the sub after the 9th and ignoring the last 2.

    sample sheet.xls

    If you need anything let me know, tearing my hair out here >.<

    Thanks a lot in advance
    Last edited by JosephP; 09-26-2012 at 07:10 AM. Reason: corrected code tags

  10. #10
    Forum Contributor wallyeye's Avatar
    Join Date
    05-06-2011
    Location
    Arizona
    MS-Off Ver
    Office 2010, 2007
    Posts
    308

    Re: Several persons initials in one cell, sent to their respective e-mail addresses.

    The last row was checking column B, but the initials in column L went further down. And, I messed up the alternate array assignment. I've cleaned it up considerably here, and made it more robust: sample sheet.xls

  11. #11
    Registered User
    Join Date
    09-13-2012
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Several persons initials in one cell, sent to their respective e-mail addresses.

    Seems to work fine, I'll test it live tomorrow morning.

    Thanks again, you've been amazing

    Lacessit

    Edit: worked perfectly, thanks again for all your help! Now I'm just going to work in a counter with the initials and make a graph with it

    Edit: Just in the process of adding an extra column to the namemap and introducting a counter which will track e-mails sent to each initial and having a bit of trouble fitting it in >.<
    Last edited by Lacessit; 09-27-2012 at 05:55 AM.

  12. #12
    Forum Contributor wallyeye's Avatar
    Join Date
    05-06-2011
    Location
    Arizona
    MS-Off Ver
    Office 2010, 2007
    Posts
    308

    Re: Several persons initials in one cell, sent to their respective e-mail addresses.

    It is difficult to get your head around the scp objects and arrays! Here is an updated sample sheet that builds a separate row index for the initials, and an array to hold the counters:

    sample sheet.xls

  13. #13
    Registered User
    Join Date
    09-13-2012
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Several persons initials in one cell, sent to their respective e-mail addresses.

    Haha you're telling me, I see what you have done though so I'm learning Thanks again for all your help!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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