+ Reply to Thread
Results 1 to 14 of 14

send all data for selected code by auto mail

  1. #1
    Forum Contributor
    Join Date
    10-30-2019
    Location
    GUJARAT,INDIA
    MS-Off Ver
    MS OFFICE 2016
    Posts
    134

    send all data for selected code by auto mail

    I have a excel file having two sheets 1)Name 2)DATA
    I want vba code for sending auto mails one after another to mail IDs in col. C of "NAME" sheet having "yes" remark in col. D
    Code should fetch all corresponding rows from DATA sheet for Code(col.B of sheet "Name") and convert to html table
    format in mail and send mail to corresponding mail address against code shown in "Name" sheet. body of mail and sample
    mail result is shown in sheet "result"
    I am using Microsoft outlook 2016 for sending and receiving mail.


    I will be very thankful if anyone can provide code.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: send all data for selected code by auto mail

    So you are trying to send one email to at least two people? in the given scenario?

  3. #3
    Forum Contributor
    Join Date
    10-30-2019
    Location
    GUJARAT,INDIA
    MS-Off Ver
    MS OFFICE 2016
    Posts
    134

    Re: send all data for selected code by auto mail

    No. I want to send mail to single person only. work of code
    1. select first "code" from Name sheet.If col.D has "yes" remark then search all rows in sheet "DATA" for selected code.
    2. Convert rows searched rows for first "code"in html table format with heading shown in sheet "RESULT"
    3. send auto mail to "code" mail Id shown in "NAME" sheet.
    4. body to mail is shown in "result" sheet.


    Then again continues above process for second "code" (i.e. B2,B3,B4.... of "NAME"sheet.
    Sheet "RESULT" is for your reference(result I expect) in Mail.

  4. #4
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: send all data for selected code by auto mail

    Here is a pass at creating your requirements. I added one column E on the NAME tab to track what was sent. A 1 denotes that the email has been sent. Let me know if you have any questions.

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

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,939

    Re: send all data for selected code by auto mail

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however it has been brought to our attention that the same query has been posted on one or more other forums and you have not provided the required cross-post link(s) here.

    Please see Forum Rule #3 about cross-posting and adjust accordingly. Read this to understand why we (and other sites like us) consider this to be important.

    (Note: this requirement is not optional. No help to be offered until the link is provided.)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  6. #6
    Forum Contributor
    Join Date
    10-30-2019
    Location
    GUJARAT,INDIA
    MS-Off Ver
    MS OFFICE 2016
    Posts
    134

    Re: send all data for selected code by auto mail


  7. #7
    Forum Contributor
    Join Date
    10-30-2019
    Location
    GUJARAT,INDIA
    MS-Off Ver
    MS OFFICE 2016
    Posts
    134

    Re: send all data for selected code by auto mail

    @Manicab

    Out Mail is as under:-
    Respected YYYY Please find hereunder your lapse list.

    code number name fup prem doc
    123456722 2 x 22020 987 20200808
    123456722 14 f 32017 602 20200985
    123456722 23 g 32014 305 20201861
    123456722 32 u 32011 8 20202737
    123456722 41 w 32008 -289 20203613
    123456722 50 i 32005 -586 20204489

    yours faithfully, kvv
    =============================================================================
    I want "Please find hereunder your lapse list." in next new line (i.e. below "Respected yyyy")
    I want "kvv" in next new line (i.e. below "yours faithfully")
    I want table data bordered in mail with BOLD fonts .
    Refer attachment (sample-14)for expected output.
    Attached Files Attached Files

  8. #8
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: send all data for selected code by auto mail

    To update the formatting, change the format of the sheet that holds the data. As for the breaks, I am still working on that

  9. #9
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: send all data for selected code by auto mail

    Here is an update with the formatted cells and HTMLbody working

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

  10. #10
    Forum Contributor
    Join Date
    10-30-2019
    Location
    GUJARAT,INDIA
    MS-Off Ver
    MS OFFICE 2016
    Posts
    134

    Re: send all data for selected code by auto mail

    I have downloaded your final xls file and try to run code but nothing is happening when I click "SendEmail" button.
    kindly check at your end.

  11. #11
    Forum Contributor
    Join Date
    10-30-2019
    Location
    GUJARAT,INDIA
    MS-Off Ver
    MS OFFICE 2016
    Posts
    134

    Re: send all data for selected code by auto mail

    sorry, I forgot to delete '1' in "sent" col. Code is giving desired results.
    Thanks for your valuable efforts.
    One more favor from your side. Can we attach created sheet to respective mail ID before deleting.(send table as attachment)

  12. #12
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: send all data for selected code by auto mail

    Here is the update you've requested. It took me some time to make the changes. Now an attachment is added to the email.

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

  13. #13
    Forum Contributor
    Join Date
    10-30-2019
    Location
    GUJARAT,INDIA
    MS-Off Ver
    MS OFFICE 2016
    Posts
    134

    Re: send all data for selected code by auto mail

    Excellent !! Thanks for your efforts. Your code is giving desired results. Your are great.

  14. #14
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: send all data for selected code by auto mail

    If that takes care of your original question, please select*Thread Tools*from the menu link above and mark this thread as SOLVED.

    Also, as a relatively new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

+ 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. [SOLVED] Working code to send mail automatic in outlook mail need little change
    By abjac in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-24-2020, 10:32 AM
  2. [SOLVED] Code to send mail copying from Excel to a new outlook mail.
    By paz1987 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-11-2015, 07:54 AM
  3. Can I use a Hyperlink to send a Workshheet from a selected workbook to a selected E Mail A
    By daviddavid in forum Outlook Programming / VBA / Macros
    Replies: 1
    Last Post: 07-30-2014, 05:14 PM
  4. [SOLVED] VBA code to send selected range in body of mail
    By forfiett in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 07-17-2014, 05:29 AM
  5. Replies: 0
    Last Post: 07-22-2012, 01:34 PM
  6. How to e-mail selected row and use e-mail address in a cell to send e-mail from excel
    By syedalamgir in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-27-2010, 02:15 AM
  7. How to Send Selected Data thourough Mail or message.
    By softysachin in forum Excel General
    Replies: 0
    Last Post: 08-18-2005, 04:05 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