Closed Thread
Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    04-05-2009
    Location
    Auckland, New Zealand
    MS-Off Ver
    Excel 2007
    Posts
    3

    Sending to Multiple Email Addresses From Cells

    Hi, I'm new to this site. It looks great. Sounds like you all have lots of experience.

    I'm a primary school class representative and I want to create an excel contact list of the parents email addresses so that I can click a button, it will open the default email (in my case MS Outlook) and then populate the "To" email address field with the email addresses (separated by a comma).

    Can anyone provide me the VB code that I can paste into my worksheet VBA that will look at a range of cells (say E2:E30) that contain email addresses, and put them in the "To" field of a blank email?

    I have put a button on the page and it's called "EmailButton" but I don't know what VB to put with it. I'm using MSExcel 2007 (at home) and 2003 (at work)

    Thanks
    Last edited by The Flightless Kiwi; 04-06-2009 at 06:42 PM.

  2. #2
    "Eagle Eyed" Forum Moderator oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Work) and 2007 (Home)
    Posts
    7,130

    Re: Sending to Multiple Email Addresses From Cells

    Hi,

    Welcome to the forum, take a look at Ron de Bruin's site here

    http://www.rondebruin.nl/sendmail.htm
    oldchippy
    -------------


    If you are happy with the help you have received, please click the blue scales icon in the blue bar of the post.

    Click here >>> Top Excel links for beginners to Experts

    Forum Rules >>>Please don't forget to read these

  3. #3
    Registered User
    Join Date
    04-05-2009
    Location
    Auckland, New Zealand
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Sending to Multiple Email Addresses From Cells

    I found that the fiorst example on this link was the closest http://www.rondebruin.nl/mail/folder3/message.htm The only change I did was remove the ".Send" and change to ".Display" so I could edit the email prior to sending. This works great for heaps of emails that get sent one at a time. I want a group type email.

    If I want to bring up ONE blank email with all the recipients in the "To" field. And the recipient email addresses were all contained in a range (Say E2:E30), what would I need to midify for the above code to work?

    Thanks again - I'm nearly there

  4. #4
    "Eagle Eyed" Forum Moderator oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Work) and 2007 (Home)
    Posts
    7,130

    Re: Sending to Multiple Email Addresses From Cells

    Hi,

    On the link in your post, there is this other link, hopefully that will help?

    Check out this page for Tips If you want to change the code on this page.
    http://www.rondebruin.nl/mail/tips2.htm
    oldchippy
    -------------


    If you are happy with the help you have received, please click the blue scales icon in the blue bar of the post.

    Click here >>> Top Excel links for beginners to Experts

    Forum Rules >>>Please don't forget to read these

  5. #5
    Registered User
    Join Date
    04-05-2009
    Location
    Auckland, New Zealand
    MS-Off Ver
    Excel 2007
    Posts
    3

    Thumbs up Re: Sending to Multiple Email Addresses From Cells

    SOLVED - Thank you old chippy!

    This works a treat. Here's the finished code. It's not tidy as it's a mish mash of bits but it works!!

    Sub EmailGroup()

    Dim cell As Range
    Dim strto As String
    For Each cell In ThisWorkbook.Sheets("Sheet1").Range("B2:B100")
    If cell.Value Like "?*@?*.?*" Then
    strto = strto & cell.Value & ";"
    End If
    Next cell
    If Len(strto) > 0 Then strto = Left(strto, Len(strto) - 1)

    Application.ScreenUpdating = False
    Set OutApp = CreateObject("Outlook.Application")
    OutApp.Session.Logon

    On Error GoTo cleanup
    Set OutMail = OutApp.CreateItem(0)
    On Error Resume Next
    With OutMail
    .To = strto
    .Subject = "Enter subject here"
    .Body = "" ' EMPTY FOR NOW
    'USE THIS FOR ENTERING NAMES OF RECIPIENTS IN BODY TEXT "here"
    '"Dear" & Cells(cell.Row, "A").Value _
    & vbNewLine & vbNewLine & _
    "Enter body text " & _
    "here"
    'You can add files also like this
    '.Attachments.Add ("C:\test.txt")
    '.Send 'Or use Display
    .Display
    End With
    On Error GoTo 0
    Set OutMail = Nothing
    cleanup:
    Set OutApp = Nothing
    Application.ScreenUpdating = True
    End Sub


  6. #6
    "Eagle Eyed" Forum Moderator oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Work) and 2007 (Home)
    Posts
    7,130

    Re: Sending to Multiple Email Addresses From Cells

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save
    oldchippy
    -------------


    If you are happy with the help you have received, please click the blue scales icon in the blue bar of the post.

    Click here >>> Top Excel links for beginners to Experts

    Forum Rules >>>Please don't forget to read these

  7. #7
    Registered User
    Join Date
    02-03-2010
    Location
    US
    MS-Off Ver
    Excel 2002
    Posts
    11

    Re: Sending to Multiple Email Addresses From Cells

    Is there a way to make that work with gmail?

  8. #8
    Forum Moderator DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Suffolk, UK
    MS-Off Ver
    2002, 2007 & 2010
    Posts
    21,379

    Re: Sending to Multiple Email Addresses From Cells

    tate2133,

    Your post does not comply with Rule 2 of our Forum RULES.

    Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread.


    You have a thread open on this topic, please stick to it.

Thread Information

Users Browsing this Thread

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

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.2.0