Microsoft Excel

Ron de Bruin
Excel Automation

Microsoft MVP Program

Mail from Excel 2016 with Mac Mail

 

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 Outlook 2016 check out this page : Mail from Mac Excel 2016 with Outlook 2016

 

Example to mail one or more sheets with Mac Mail as workbook or PDF

Download example files and script file (File date : 14-Sept-2017)

Note: There is a example workbook to send as workbook and as PDF, there is different code if you use Sierra as OSX because a bug with signatures in the new version of Mail in Sierra.

Where must I copy the file(RDBMacMail.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

Now open the Excel file and read the information on the worksheet how you can test the code, please give feedback if you have problems because it is new for me also and there is almost no documentation about it. It is trial and error to get things working in Office 2016 the same way as in Office 2011.

 

Acknowledgements

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

 

RDBMailActivesheet Add-in Beta

Check out : Send Activesheet with Mac Mail as workbook or PDF in 2016