+ Reply to Thread
Results 1 to 9 of 9

Issue with sending email from Excel

  1. #1
    Registered User
    Join Date
    06-24-2011
    Location
    ENGLAND
    MS-Off Ver
    Excel 2007
    Posts
    39

    Issue with sending email from Excel

    Hello All!

    Ive done quite a bit in Excel in the past, but have never set up a process that sends mail, so I'm having difficulties. So I've taken coding from http://spreadsheetpage.com/index.php...il_from_excel/ and http://forums.techguy.org/archive-bu...el-quotes.html
    ...and it works beautifully in excel.
    -----------------
    Please Login or Register  to view this content.
    ---------------------------

    Outlook loads, and its then just a case of hitting the send button, and the email just contains info in the subject line.

    The workbook that this sits in is pretty much a database containing employee data in up to 10 columns and 150 rows.

    I need to send an email to some of the employees in the list, and to do this, the send button would be located on each row, the macro pulling in info from the respective row (namely the email and the data in column L).

    The problem is, as the macro is now, I'd need 150 slightly-different copies of the macro, which is silly.

    So, what I need is the macro to be amended so that when you hit the button on the row you want, it just creates the email based on the data in that row. The end goal is to just have one macro, but 150 buttons, one on each row.

    I hope thats clear....

    I would include a copy of the spreadsheet if I knew how to attach files to the post...

    Any help that you guys could offer would be very very appreciated!

    Adam

    ---------------
    Excel 2007
    Please Login or Register  to view this content.
    Last edited by a8747; 06-28-2011 at 06:10 PM.

  2. #2
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Issue with sending email from Excel

    I'd suggest having a look at this page: http://www.rondebruin.nl/sendmail.htm

    Details of how to attach a workbook are on the forum rules page.

    Dom
    "May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."

    Use code tags when posting your VBA code: [code] Your code here [/code]

    Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.

  3. #3
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Issue with sending email from Excel

    Hi Adam

    What you're describing is very doable. I'd like to understand the process. For example, you have 150 buttons to send emails and you wish to send an email to 1 or 10 or 100 of those buttons...what's the criteria you use to select the button of the 1 or 10 or 100? Is the criteria different for each individual? Or is it such that I need to send emails to 14 people because Column J says "Gotcha"?
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  4. #4
    Registered User
    Join Date
    06-24-2011
    Location
    ENGLAND
    MS-Off Ver
    Excel 2007
    Posts
    39

    Re: Issue with sending email from Excel

    Quote Originally Posted by jaslake View Post
    Hi Adam

    What you're describing is very doable. I'd like to understand the process. For example, you have 150 buttons to send emails and you wish to send an email to 1 or 10 or 100 of those buttons...what's the criteria you use to select the button of the 1 or 10 or 100? Is the criteria different for each individual? Or is it such that I need to send emails to 14 people because Column J says "Gotcha"?
    Hello John, thanks for responding.

    The criteria is almost entirely random and at the discretion of the user.
    An email would only be sent when the data in a cell in the critical column changes. Now normally, I understand that with that, you could then do a worksheet_change event macro, but in this case, even when the data in a cell changes, it is still up to user discretion whether or not an email is sent to the person.

    The way I have set it up at the moment is that at the top of the sheet, there is a single button, the user clicks, up comes an input box and the user types in the row number for the person that they want to send the email to. This works well, but if there is another way, I'd be interested to see.

    thx

    Adam

  5. #5
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Issue with sending email from Excel

    For max freedom for the user and the simpest method to create emails see the attachment.
    Attached Files Attached Files



  6. #6
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Issue with sending email from Excel

    Hi Adam

    This code is in the attached. It's a sample of what you can do with Excel/Outlook. Let me know of issues.
    Please Login or Register  to view this content.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    06-24-2011
    Location
    ENGLAND
    MS-Off Ver
    Excel 2007
    Posts
    39

    Re: Issue with sending email from Excel

    Quote Originally Posted by jaslake View Post
    Hi Adam

    This code is in the attached. It's a sample of what you can do with Excel/Outlook. Let me know of issues.
    Please Login or Register  to view this content.

    John, that's just what I needed, and it works perfectly! Thanks

  8. #8
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Issue with sending email from Excel

    Hi Adam
    Glad it works for you. If that satisfies your need, please mark your thread as "Solved".

    To mark your thread solved do the following:
    - Go to your first post on the thread
    - Click edit
    - Click Advance
    - Just below the word "Title:" you will see a dropdown with the word No prefix.
    - Change to Solved
    - Click Save

  9. #9
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: Issue with sending email from Excel

    a 8747, please refrain from quoting entire posts. They make threads difficult to read and uselessly long.Thx

+ 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