Articles | Photoshop and Photography blog | about me |e-mail

ProjectWoman

Welcome to Helen Bradley's Microsoft Office and productivity blog. I'm a lifestyle journalist specializing in business and consumer software and here you'll find handy hints for using software such as Microsoft Office 2007 and other office applications. Elsewhere on projectwoman.com you'll find tutorials, articles, how tos and tips on photography and Photoshop CS3. My publishing credits include PC Magazine, Windows XP magazine, CNet, PC User magazine, InformIT and others.

Thursday, March 20, 2008

What's in a name? Auto_Open or AutoOpen

Sometimes you wonder if the folks up at Redmond are laughing at us behind our backs. Really, do they deliberately set out to confuse us or are they just that plain disorganised?

Today my quandary involves Auto_Open and AutoOpen. These are two special macro names. The first, Auto_Open is Excel's special named macro that runs automatically when the workbook containing it is opened. AutoOpen is the Word equivalent. It makes no sense that one has an underscore and the other doesn't - it just makes life for us VBA folk a little more confusing than it should be.

The other macros Auto_Close and AutoClose work the same way, Auto_Close is the Excel macro name - call a macro by this name and save it in your workbook and it will run whenever you close the workbook. In Word, the name is AutoClose.

To add to the confusion, PowerPoint doesn't support either of the naming conventions, in fact, you can't create auto running macros in PowerPoint the same way you do in Word and Excel. The workaround is cumbersome, you need to create a PowerPoint add-in that includes the Auto_Open subroutine. Load the Add-in and PowerPoint will run the code in Auto_Open it loads and ditto for subroutine called Auto_close - it runs when the add-in is unloaded - which happens automatically when you exit PowerPoint. Learn more about how to do this in this KnowledgeBase article.

Thanks Redmond, we are now officially confused!

Labels: , , , , , , ,

Add to Technorati Favorites

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home