Previous  Home  Next

Other tips

Tips

And possibly my favorite add-in tip:

I said earlier that you can't edit or even see your code if you haven't saved it as a PPT first (ie, if the add-in/PPA is the only file you've got)?

I lied.

But only a little.

The average user can't see code inside add-ins. You can. Here's how. This involves editing the registry so all the usual caveats, cautions, warnings and do not remove this tag under penalty of breath stuff applies. If you don't know what you're doing, don't do. 'Nuff said.

Make sure PowerPoint is NOT running.

Start Regedit and go here:

HKEY_CURRENT_USER\Software\Microsoft\Office\X.0\PowerPoint\Options

For X.0 substitute the number for the version of PowerPoint you use.

14.0 = PowerPoint 2010
13.0 = No such animal. MS is superstitious.
12.0 = PowerPoint 2007
11.0 = PowerPoint 2003
10.0 = PowerPoint 2002
9.0 = PowerPoint 2000
8.0 = PowerPoint 97

Add a new entry under Options:

DebugAddins REG_DWORD = 1

Close Regedit.

Start PowerPoint and press F11 to open the IDE. You'll now see any installed add-ins (other than COM add-ins) listed in Project Explorer. You can open and edit any that aren't password protected. You can even set breakpoints and debug the code in the running add-in.

There are a few gotchas:

There's a Save item on the File menu in the IDE. PowerPoint does a great job of pretending it's saving your changes when you click it. Don't trust it for a minute.

Any changes you made to the code in your add-in disappear when you unload the add-in or quit PowerPoint.

Instead, use one of these options:

This may seem like a bit of trouble but it can save hours over the alternative: edit the PPT, save as PPA, load PPA, test, unload PPA, load PPT, edit PPT, save as ... and so on.

One other thing: if something crashes the add-in and the error isn't handled, it's liable to lose track of anything stored in variables and arrays. It's not a bad idea to put the code needed to initialize variables into a subroutine by itself. That way you can run this code to re-set your variables after a crash while you're debugging.

Click Next to continue

Previous  Home  Next