Email for Excel

Discussion in 'MacBook Pro' started by VbaHell, May 7, 2011.

  1. VbaHell macrumors newbie

    Joined:
    May 7, 2011
    #1
    I am trying to run this VBA macro from excel to auto send emails. This works fine with Outlook but not with the Mac Mail Client.
    Has anyone in the MacRumors world got any VBA code to send via Mac Mail client


    Sub DoALL()
    Dim Mail_Object, Email_Subject, nameList As String, o As Variant
    For i = 1 To 2
    If Sheets("Mail").Range("c1").Value <> "" Then 'Change Sheet name to suit
    nameList = nameList & ";" & Sheets("Mail").Range("I" & i).Value 'Change Sheet name to suit
    End If
    Next
    Set Mail_Object = CreateObject("Outlook.Application")
    With Mail_Object.CreateItem(o)
    .Subject = "SUBJECT"
    .To = nameList
    .Body = "BODYTEXT" & Chr(13) & Chr(13) & "Regards," & Chr(13) & "VbaHell"
    .Send
    End With
    MsgBox "E-mail successfully sent", 64
    Application.DisplayAlerts = False
    Set Mail_Object = Nothing
    End Sub
     
  2. miles01110 macrumors Core

    miles01110

    Joined:
    Jul 24, 2006
    Location:
    The Ivory Tower (I'm not coming down)

Share This Page