excelvbamacosemailapple-mail

Create new mail on Mac using Excel VBA


I need to adjust my macro described below that it runs on mac with using Apple Mail application.

Sub SendMail()

    Dim OutlookApp As Object: Set OutlookApp = CreateObject("Outlook.Application")
    Dim var As Variant: var = Selection.Value
    Set MyMail = OutlookApp.CreateItem(0)
    With MyMail
        .To = var(1, 8)
        .Subject = "Skuska"
        .body = "Dobry den...bla bla bla" & vbNewLine & vbNewLine & var(1, 2) & vbNewLine & var(1, 3) & vbNewLine & var(1, 5) & "  " & var(1, 4) & vbNewLine & vbNewLine & "Tel.c.:" & vbNewLine & var(1, 6) & vbNewLine & var(1, 7) & vbNewLine & vbNewLine & var(1, 9) & vbNewLine & vbNewLine & "S pozdravom" & vbNewLine & "Meno" & vbNewLine & "Tel."
        .sent
    End With
End Sub

This macro run with Outlook but I´m using Apple Mail.


Solution

  • Outlook for Mac 2011 (nor Apple Mail) does not support VBA. As far as I know automation of Outlook for Mac or Apple Mail can be accomplished using Applescript and/or Automator. See Introduction to Scripting Mail for more information.