Business

Office 2011: the macro is back

For years, Excel 2008 has been teasing me: Every time I launched the app, I’d see that menu item, mocking me, tempting me to click. “Go ahead,” it would whisper, “You know you want to. This time it’ll work—really, it will.”

But selecting Tools -> Macros in Excel 2008 ( ) would only remind me, once again, that the Macros menu was but a mere shell of its former Excel 2004 self. It seemed to exist for no other reason than to annoy those of us who used and relied on Visual Basic for Applications (VBA) macros. Sure, that menu might show you some really old macros, the ones written in the Excel 4.0 macro language. But it wouldn’t show you anything written with VBA. And if the sheet you were looking at included VBA macros, they wouldn’t run.

Excel 2008 macro window
Excel 2008's macro window: sadly, empty.
“But what about AppleScript,” you ask? Sure, Excel 2008 supported OS X's built-in scripting language. But AppleScript couldn’t really replace the functionality of VBA. You couldn’t, for example, use AppleScript to change Excel’s menu structure, to manage a data-input form, or to change spreadsheet values on the fly—all things you could easily do with VBA.

Now, with the release of Excel 2011 ( ), Microsoft has brought VBA support back to Excel for the Mac—and the Tools -> Macro menu item is once again useful.

Old and new

In my testing so far, Excel 2011 runs older macros just fine. I opened one macro-laden worksheet I’d created back in 1992 in Excel 2011; it ran perfectly. I also opened a number of Excel 2004 worksheets, all of which used macros to some degree or another, and they also worked as expected.

New macros I’ve recorded so far all worked as expected. The Visual Basic Editor’s work area is mostly identical to that of Excel 2004’s, but with a few nice additions. For instance, the Edit menu features some new options for viewing properties, methods, constants and parameters. In the Debug menu, you can create Watch functions, which allow you to watch an expression and to stop the macro when a value changes or a condition becomes true.

Microsoft’s Excel 2011 team has also worked to make Mac macros compatible with those written for Excel for Windows. According to Microsoft, Excel 2011 for Mac features a full port of the Windows Office VBA environment; in most cases, the OS X and Windows versions of VBA now mirror each other. This includes updating the core VBA engine in Office 2011 to VBA version 6.5, and adding some commands (FormatCurrency, FormatNumber, Replace) that had been disabled in Excel 2004 for the Mac. When there were object-model differences between the Windows and OS X versions, Microsoft says it conformed the Mac version to Office 2010. (Macworld hasn’t had the opportunity to fully test that Windows-compatibility yet.)

Overall, I’ve been quite happy with the macro experience in Excel 2011. Now that Tools -> Macros does something useful once again, I can finally retire Excel 2004.

Product mentioned in this article

(1 items)

Subscribe to the Apple @ Work Newsletter

Comments