Microsoft Excel

Ron de Bruin
Excel Automation

Microsoft MVP Program

Mail from Mac Excel 2016 with Outlook 2016

 

What is changed between Office 2011 and Office 2016

The legacy "MacScript" VB Command is severely limited by Apple’s sandbox requirements: it will not work correctly in most situations in Office 2016. Updating the MacScript function seems to be too difficult.

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 : AppleScriptTask in Office 2016 for the Mac

If you use Mac Mail check out this page : Mail from Excel 2016 with Mac Mail

 

Examples to mail with Mac Outlook 2016

Download examples, add-in and script file in Zip format (File date : 13-March-2017)

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

Where must I copy the file(RDBMacOutlook.scpt) 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, two of them have code examples in it so you can test.

MacOutlookWithExcel2016.xlsm to create a mail with the activesheet, selection or workbook MacOutlookWithExcel2016PDF.xlsm to create a mail with the activesheet,selection or workbook as PDF.

The third workbook you can use to test the add-in, see the next part on this page.

 

Add-in to send the activesheet as workbook or PDF

In the download you can find also a add-in (MacOutlook2016ActiveSheet.xlam) and a example workbook(TestworkbookForMailAddIn.xlsx) that you can use to test the options in the add-in. Go to Tools>Add-ins to browse to the add-in and select it. After you have done this you will notice the new tab named RDBMail in the Ribbon.

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.

 

Acknowledgements

Many thanks to Bastiaan Boertien(applescript specialist) for his help to get this working