These topics are about converting VBA to AppleScript for Microsoft Office 2004. Some of the concepts, syntax, and code samples might not apply if you are working with AppleScript for Office 2008.
There are good reasons to upgrade to Office 2008 for Mac, even if you don't have to have the latest of everything. However, you won't be able to use Visual Basic for Applications (VBA) to develop your macros.
![]() | Upgrading to Office 2008 |
Office 2008 has tons of new features. For example, Office 2008 is a universal binary, running natively (and fast) on Intel- and PowerPC-based Macintosh computers.
Office 2008 can also create files in the new Open XML Formats that are used by the 2007 Microsoft Office suite for Windows, so you aren't left out of the new features and robust functionality that the new file formats provide. Microsoft Office 2004 can open and read these files with the new Open XML file format converter for Mac, but you can't save in the new format. You need Office 2008 for that.
However, alongside lots of other new features is the removal of VBA from Office 2008. VBA is the programming language used for macros in Microsoft Word, Excel, and PowerPoint that functions cross-platform on both the Macintosh and Windows versions of the same Office applications.
![]() | VBA for Office 2008 removed |
Why remove VBA for Office 2008? While Office 2008 was built to be a universal application because Apple moved to Intel processors, the Macintosh VBA compiler was originally designed for a much earlier PowerPC-based Macintosh and will not work, without significant modifications, on the Intel-based Macintosh. VBA macro code is compiled at runtime, and the compiler code, VB editor code, and VB forms code could not be converted for the Intel-based Macintosh without extensive programming work that would have significantly delayed the universal version of Office 2008.
The Microsoft Office for Windows version of VBA can't be directly used for Office 2008 because it depends on execution of Windows machine assembly, which isn't compatible with the Mac OS.
![]() | Options Without VBA for Office 2008 |
So what are your options for Office 2008? You could stick with Office 2004, running in Macintosh Rosetta on Intel-based Macintosh computers. However, you will miss out on all the new features of Office 2008.
Furthermore, macros found in the new "m" file formats of 2007 Office suite for Windows (.docm, .xlsm, .pptm) will not run on and can't be converted for Office 2004 (or Office 2008, or any version of Office for Mac).
The people most affected by the loss of VBA are those who need cross-platform programmability for Office. There may be some options to control Office externally. However, other possible solutions are outside the scope of this document.
You could also investigate alternative automation technologies such as AppleScript.
![]() | Working with AppleScript |
Office 2004 completely revised and introduced enormous new AppleScript implementations for Word, Excel, and PowerPoint. Meanwhile, Microsoft Entourage, which exists only on the Macintosh, has always had an excellent AppleScript implementation, and has never had VBA support.
The AppleScript implementations virtually mirror the Windows VBA object model for these applications. That's because both languages access a deeper-level framework called OLE Automation. So, virtually everything you can do in VBA, you can also do in AppleScript.
AppleScript also opens up the world of Macintosh to you. A lot of other Macintosh applications are also "AppleScriptable," so you can set up automated inter-application workflows.
And, you can take advantage of the new Macintosh Automator technology, which is especially promising because Microsoft is supporting Office 2008 with Macintosh Automator features.
The entire Macintosh world is now your automated oyster.
![]() | How to use these articles |
These articles will:
Introduce you to AppleScript and its syntax
Provide pointers to resources where you can learn more
Review some basics of converting VBA to AppleScript that are applicable throughout Office
Convert sample macros in Word, Excel, and PowerPoint, highlighting important elements in action
Provide examples of how to integrate applications with Entourage
![]() | Start converting to AppleScript now |
If you have a lot of macros, it will take time to convert them to AppleScript. Office 2004 can display both VBA macros and scripts in Macintosh Script Editor simultaneously, so you can get your scripts ready and functioning. Moreover, don't forget that when you upgrade to Office 2008, you won't be able to open or view your macros there.
In fact, it is recommended that you keep Office 2004 on your computer even after you upgrade, for just this reason. The two versions shouldn't cause conflicts. It's possible to keep Microsoft Office v. X and Office 2004, even Office 2001 on PowerPC-based computers with Classic, side-by-side, although you might not want to have them running at the same time. There are a few tricks you need so that you can use Script Editor with more than one version of an application, which will be explained later.
![]() | Prerequisites |
These articles assume that you know a bit of VBA, and that you've either written VBA macros or tinkered with macros designed for Microsoft Office for Windows to adapt them for the Macintosh. You may or may not yet know some AppleScript as well, but you will need to learn now. There are pointers to resources and tips for learning more in the articles.



