+ Reply to Thread
Results 1 to 29 of 29

Send mail to all in range

  1. #1
    Forum Contributor
    Join Date
    12-13-2012
    Location
    Italy
    MS-Off Ver
    Excel 2010
    Posts
    162

    Send mail to all in range

    Good day to all.

    I need a macro that will send a separate mail to each person in range (Data sheet), with body from Mail sheet of attached excel workbook.
    For attached examle it should send 5 mail, that have to be like:

    Good day,

    We are missing bellow books:

    AAAAAAAAA John

    brgds,
    Alex
    Thanks in advance.

    brgds,
    forfiett
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Send mail to all in range

    Please Login or Register  to view this content.
    Take the ' away from .send and put a ' infront of .display if you want the email to be automatic
    Attached Files Attached Files
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Send mail to all in range

    this code does not check if same person has multiple books but will create a single separate email per line 4 until last email in column C

  4. #4
    Forum Contributor
    Join Date
    12-13-2012
    Location
    Italy
    MS-Off Ver
    Excel 2010
    Posts
    162

    Re: Send mail to all in range

    Dear,

    it is working but not like i need it ..because if one "customer" has more bookings then he will get for each booking one mail, it is it possible to send it on mail for with all booking number.

    Please check attached excel file.

    Thanks,
    forfiett
    Attached Files Attached Files

  5. #5
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Send mail to all in range

    you should really outline this request this in initial question
    the coding will be substantially more complicated as it would require extra logic

    let me have a think about it i will reply tomorrow

    Cheers
    hum

  6. #6
    Forum Contributor
    Join Date
    12-13-2012
    Location
    Italy
    MS-Off Ver
    Excel 2010
    Posts
    162

    Re: Send mail to all in range

    Dear Hum,

    I apologize if I was not clear enough.

    Ok, no problem, waiting to hear fm you.

    Thanks & have a nice day.
    brgds,
    forfiett

  7. #7
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Send mail to all in range

    i thought of a quick way to do it so i did it today

    the list must be sorted by email prior to running

    ie you cant have JOhn, alex than john again
    Must be john, john, alex or alex, john, john
    otherwise it will create 3 emails instead of 2
    Attached Files Attached Files

  8. #8
    Forum Contributor
    Join Date
    12-13-2012
    Location
    Italy
    MS-Off Ver
    Excel 2010
    Posts
    162

    Re: Send mail to all in range

    Dear,

    thanks for provided, am testing it.

    now the mail looks like:

    Good day,
    We are missing below books:
    AAAAAAAAA John
    brgds,
    Alex
    it is possible that

    AAAAAAAAA John

    looks like in a excel, so like table (please check attached file, mail sheet)

    thanks,
    forfiett
    Attached Files Attached Files

  9. #9
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Send mail to all in range

    yes possible but my HTML skill is very limited

    need to then change
    .body to .htmlbody
    replace all the vbnewline with <BR>

    then basically have to write the message in HTML
    like shown here
    https://computerservices.temple.edu/...ng-tables-html

  10. #10
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Send mail to all in range

    actually looking at the HTML you will have to rewrite the whole logic on how email is populated

  11. #11
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Send mail to all in range

    Please Login or Register  to view this content.
    doesn't look pretty...but it works for single line...would need to revisit logic to make it work for multiple line

  12. #12
    Forum Contributor
    Join Date
    12-13-2012
    Location
    Italy
    MS-Off Ver
    Excel 2010
    Posts
    162

    Re: Send mail to all in range

    Dear,

    can you please help me with that, I am not so familiar with HTML...ecc.

    THANKS

  13. #13
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Send mail to all in range

    will take some time
    i am unfamiliar with HTML as well

  14. #14
    Forum Contributor
    Join Date
    12-13-2012
    Location
    Italy
    MS-Off Ver
    Excel 2010
    Posts
    162

    Re: Send mail to all in range

    ok, no problem. Many Thanks!!

  15. #15
    Forum Contributor
    Join Date
    12-13-2012
    Location
    Italy
    MS-Off Ver
    Excel 2010
    Posts
    162

    Re: Send mail to all in range

    Dear,

    another question...why evry time after running these macro excel freezes?? == these is now "solved"...i noted that if table with e-mail adresses is more than 20 lines excel freezes, is there any way to solve it?

    to make it a little bit easier..it is possible to inclued in body of mail only book no (column A) without Name (column B)?
    Last edited by forfiett; 07-24-2014 at 09:06 AM.

  16. #16
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Send mail to all in range

    Please Login or Register  to view this content.
    managed to wrangle HTML code with Book and Name already
    sorry does not look the best but can be fixed thru HTML formatting
    things like font, font size, color etc which is all set via HTML

    with freezing
    not really why what is happening
    its probably just excel running thru your macro which tends to freeze once code becomes long
    Attached Files Attached Files

  17. #17
    Forum Contributor
    Join Date
    12-13-2012
    Location
    Italy
    MS-Off Ver
    Excel 2010
    Posts
    162

    Re: Send mail to all in range

    Dear, great job, very good. Many thanks!.

    it is possible to include only book no without name?

    thanks

  18. #18
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Send mail to all in range

    Please Login or Register  to view this content.

  19. #19
    Forum Contributor
    Join Date
    12-13-2012
    Location
    Italy
    MS-Off Ver
    Excel 2010
    Posts
    162

    Re: Send mail to all in range

    Dearj,

    thanks for quick reply but I managed to do it myself :D...

    but is still not as they wish ...
    the table must look like:

    table.JPG

    with included name....ok these is already done :D

    i have tried a lot of options without positive result ..pls help

    Can someone help me also with bellow code:

    Please Login or Register  to view this content.
    i dont know why between
    Worksheets("data").Range("O6").Value & "</p>" & _
    and
    "<p style='font-family:calibri;font-size:12;color:grey'>" & Worksheets("data").Range("O7").Value & "<br>" & _
    it puts a empty line..how to solve it? what am I missing?
    Last edited by forfiett; 07-25-2014 at 09:06 AM.

  20. #20
    Registered User
    Join Date
    02-01-2011
    Location
    California, Sacramento
    MS-Off Ver
    Excel 2010
    Posts
    92

    Re: Send mail to all in range

    forfiett,

    Remove the "T" from this line:
    HTML Code: 
    Should fix the spacing.

    BigDawg15

  21. #21
    Forum Contributor
    Join Date
    12-13-2012
    Location
    Italy
    MS-Off Ver
    Excel 2010
    Posts
    162

    Re: Send mail to all in range

    Dear,

    thanks for quick reply. I am currently on vacation so will check and advise if back in office.

    Best regads,
    forfiett

  22. #22
    Forum Contributor
    Join Date
    12-13-2012
    Location
    Italy
    MS-Off Ver
    Excel 2010
    Posts
    162

    Re: Send mail to all in range

    Quote Originally Posted by BigDawg15 View Post
    forfiett,

    Remove the "T" from this line:
    HTML Code: 
    Should fix the spacing.

    BigDawg15
    Dear, it is not wokring..still is the empty line. Any other option?

  23. #23
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Send mail to all in range

    Hi, forfiett,

    maybe look up what
    HTML Code: 
    stands for in HTML: adding a paragraph which could be seen as adding an empty line.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  24. #24
    Forum Contributor
    Join Date
    12-13-2012
    Location
    Italy
    MS-Off Ver
    Excel 2010
    Posts
    162

    Re: Send mail to all in range

    So with paragraph we cannot colve it

    Is there any other way to define font colour....for that singe line?

  25. #25
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Send mail to all in range

    Hi, foorfiett,

    I didnīt go through all the codes before so I may miss some important things:
    HTML Code: 
    Ciao,
    Holger

  26. #26
    Forum Contributor
    Join Date
    12-13-2012
    Location
    Italy
    MS-Off Ver
    Excel 2010
    Posts
    162

    Re: Send mail to all in range

    Hi Holger,

    still not ok ....have tried 1000 different possibilities without result..
    The problem now is that font size is set up to 11, but it is 12 for entire mail...why?????
    Last edited by forfiett; 08-05-2014 at 12:15 PM.

  27. #27
    Forum Contributor
    Join Date
    12-13-2012
    Location
    Italy
    MS-Off Ver
    Excel 2010
    Posts
    162

    Re: Send mail to all in range

    Any good news for me??

  28. #28
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Send mail to all in range

    Hi, forfiett,

    have tried 1000 different possibilities without result..
    Sorry I canīt see any of these in this thread.

    One of the first addresses in www. is the site of Ron de Bruin on which you could find a tool called RangeToHTML. I wonder why your search engine hasnīt delivered one of the top articles.


    The original problem was about passing the data for the individual mails - I read itīs solved so you should have that part of the code. The following code is putting the data from the sheet Mail into a mail:

    Please Login or Register  to view this content.
    Itīs essential to copy the foillowing function into either the very same standard module or any other one in the project:
    Please Login or Register  to view this content.
    And if you are referring to HTML and size Iīm afraid HTML just has about 7 different sizes.

    Ciao,
    Holger

  29. #29
    Forum Contributor
    Join Date
    12-13-2012
    Location
    Italy
    MS-Off Ver
    Excel 2010
    Posts
    162

    Re: Send mail to all in range

    Dear Holger,

    just to clarify...i have tried really a lot of options and obviously have not posted all of them on forum.
    Have also looked on Ron de Bruin page that was not helpfull.

    Now I find a solution = FONT is not supported in HTML5 anymore, but is was replaced by span style that it is also my solution.
    It is working perfectly.

    Thanks for you assistance.

    best regards,
    Forfiett

+ 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] 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
  2. Replies: 1
    Last Post: 03-11-2014, 12:24 PM
  3. Using VBA to send a range in pdf via e-mail
    By BullseyeThor in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-22-2013, 11:54 AM
  4. Replies: 3
    Last Post: 05-11-2012, 09:21 AM
  5. 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

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