+ Reply to Thread
Results 1 to 10 of 10

Sending mail macro to multiple addresses

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    04-01-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    128

    Sending mail macro to multiple addresses

    Hi,

    I need a macro which would send a macro to multiple addresses. The body of the mail will be the same..I want the macro to give me an option to type what should be mentioned in from column, to column...Subject and body will be the same throughout...There are multiple id's in which the mail should be sent so I need an option to select multiple users at a time..if possible let me know then i will give you the subject as well as the body of the mail...

  2. #2
    Forum Contributor
    Join Date
    04-01-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    128

    Re: Sending mail macro to multiple addresses

    No one to help yet

  3. #3
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,060

    Re: Sending mail macro to multiple addresses

    there are plenty of examples....
    try this one, in column A (email addresses), column B(body), column C (yes or no), cell D1(subject)
    Sub Button1_Click()
     Dim OutApp As Object
        Dim OutMail As Object
        Dim cell As Range
    
        Application.ScreenUpdating = False
        Set OutApp = CreateObject("Outlook.Application")
    
        On Error GoTo cleanup
        For Each cell In Columns("a").Cells.SpecialCells(xlCellTypeConstants)
            If cell.Value Like "?*@?*.?*" And _
               UCase(Cells(cell.Row, "c").Value) = "YES" Then
                Set OutMail = OutApp.CreateItem(0)
                On Error Resume Next
                With OutMail
                    .To = cell.Value
                    .Subject = [d1]
                    .Body = Cells(cell.Row, "b").Value
                    'to add attachment use .Attachments.Add ("C:\test.txt")
                    .display  'change to "send" when not in TEST mode
                End With
                On Error GoTo 0
                Set OutMail = Nothing
            End If
        Next cell
    
    cleanup:
        Set OutApp = Nothing
        Application.ScreenUpdating = True
    
    End Sub
    Regards, John55
    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.

    ...enjoy -funny parrots-

  4. #4
    Forum Contributor
    Join Date
    04-01-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    128

    Re: Sending mail macro to multiple addresses

    This is good...But it doesnt automatically send it to the adresses...we have to click on send in outlook again and again. So can you please amend it accordingly so that it would send directly? Thanks...

    (Note : If heading wouldnt be there then my users wont know where n what we have to fill in)
    Last edited by Raju Radhakrishnan; 08-21-2012 at 08:39 AM.

  5. #5
    Forum Contributor
    Join Date
    04-01-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    128

    Re: Sending mail macro to multiple addresses

    And also I want to change the FROM column. rest all superb

  6. #6
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,060

    Re: Sending mail macro to multiple addresses

    Please have a look and you'll see a note near .Display, it means replace it with .Send, it will send the email(s) automatically.

  7. #7
    Forum Contributor
    Join Date
    04-01-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    128

    Re: Sending mail macro to multiple addresses

    Hi,

    I have attached the macro file. I need this to be amended appropriately.

    1) When i added headings... Subject column is showing as subject in mail.

    2) I want the from column to be xxxx (I want to add a name which is confidential)

    Rest all fine and thanks for replying
    Attached Files Attached Files

  8. #8
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,060

    Re: Sending mail macro to multiple addresses

    try this
    '
    '
     .Subject = [d2]
    '

  9. #9
    Forum Contributor
    Join Date
    04-01-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    128

    Re: Sending mail macro to multiple addresses

    That worked. One thing i want is FROM...Its still showing as Raju Radhakrishnan. I want that to be edited. possible?

  10. #10
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,060

    Re: Sending mail macro to multiple addresses

    As far as i know "From" comes from yr settings of outlook!
    I am sorry, I can not help you!

    Have a nice evening!

+ 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