Send Mail from Mac Excel with Mac Outlook

What is changed between Office 2011 and Office 2016 and up

The legacy "MacScript" VBA Command is severely limited by Apple’s sandbox requirements: it will not work correctly in most situations in Office 2016 and up.

Instead, Microsoft added a new VB command "AppleScriptTask" that accesses and runs an AppleScript file located outside the sandboxed app. This new approach is not as convenient: with the MacScript function you could have the script in the file itself, while with the AppleScriptTask method you need to distribute an extra file containing the script, and it must be placed in the specified location on the user’s system to have permission to run. This requires some user interaction the first time.

See this page if you want to learn more : How to use AppleScriptTask in Mac Office
If you use Mac Mail check out this page : Send Mail from Mac Excel with Mac Mail

Mail with Mac Outlook 2016 and up in Catalina and up


Problems with mailing from Mac Excel with Mac Outlook


1: If you use the New Outlook you are not able to use to set the mail account in the code because AppleScript not see the mail accounts. If you not set the account it will use the default mail account. When you not use the New Outlook you can set every account you want.

2
: if you use the Old Outlook When my examples code display the mail and you want to close the mail you not get an option to save a or delete the mail, it will always be saved in the Draft folder. If you click on the Send button or change my code that it will send directly you not have this problem. No problem if you use the New Outlook.

Note: Mailing with code with Mac Mail not have the problems above.

After you download the zip file you see 3 Excel workbooks and one script file, before we can test the code examples we must copy the script file in the correct location of your Mac. You only have to do this one time. The example workbooks use this script file, without it the examples will not work.

Download example files and script file (File date : 20-Feb-2021)

In the 20 Feb 2021 code and script I add an option to add other files to the mail and to only mail text and the HTML body example align left now. And there is also an example to mail row data to each person in a row, for example to send grades to students.


Where must I copy the file RDBMacOutlook.scpt(2) with the script :
  • Open a Finder Window
  • Hold the Alt key when you press on Go in the Finder menu bar
  • Click on Library
  • Click on Application Scripts (if it exists; if not create this folder)
  • Click on com.microsoft.Excel (if it exists; if not create this folder) note: Capital letter E
  • Copy the script file from the download inside this folder

Test the code in the workbooks

You have download 3 workbooks with code examples in it for testing. Be sure your Office install is up to date, Look in the Excel Help menu for "Check for updates"

MacOutlookWithExcel.xlsm to create a mail with the ActiveSheet, Selection, WorkBook, only text, row data

MacOutlookWithExcelPDF.xlsm to create a mail with the ActiveSheet, Range or WorkBook as PDF

MacOutlookWithExcelHTMLBody.xlsm to create a mail with the ActiveSheet/Selection in the body


Please give feedback, good or bad. There is no object model for Outlook so it is trial and error to get things working in Mac Office 2016 and up.
31-July-2021
Web design by Will Woodgate