How can I debug event handler code in the IDE?

G

Guest

Pretty much says it all ...

I'm using PPT 2007, and have devloped an extensive set of add-ins using
VBA. I would like to debug that code to isolate some differences between the
2003 and 2007 implementations, and I'm tired of inserting MsgBoxes all over
the place, recompiling, saving the .ppam, rebuilding the ribbon xml, etc.
Surely there's an easier way? I just want to put a break in the code and
then Run a macro that ultimately causes one of the events to fire and then
break at the point of interest. Is that posssible? How?

Thanks.
 
S

Steve Rindsberg

Dave Jenkins said:
Pretty much says it all ...

I'm using PPT 2007, and have devloped an extensive set of add-ins using
VBA. I would like to debug that code to isolate some differences between the
2003 and 2007 implementations, and I'm tired of inserting MsgBoxes all over
the place, recompiling, saving the .ppam, rebuilding the ribbon xml, etc.
Surely there's an easier way? I just want to put a break in the code and
then Run a macro that ultimately causes one of the events to fire and then
break at the point of interest. Is that posssible? How?

O boy are you gonna love THIS one:

Quit PPT if it's running.

Start Regedit and burrow to:

HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\PowerPoint\Options
Change the 12 to 11 for 2003, 10 for 2002 etc.

Add a new DWORD, DebugAddins and set the value to 1

Start PPT, open the IDE and you can debug your running addin just as though it
were the source file.

Just remember that even if there's a Save item on the file menu, it doesn't
work. To save changes, you have to open the original PPTwhatever, make changes
there, save and re-make the addin.

Sometimes the easiest thing is to export the modules you've changed while
debugging the PPA, then import them into the PPT
 
G

Guest

Thanks, Steve.

Do I need to reboot after the reg edit? I added the DebugAddins parameter,
but nothing seemed to change. Maybe I'm suffering from a terminal case of
user error. Here's what I attempted to do:

1. Brought up the .ppt containng the code I wanted to debug
2. Placed a breakpoint on the first line of code I KNOW gets executed on a
certain event.
3. Went back to the Slide view and triggered the event (which fired), but I
didn't enter the debugger.

Well, that's not too much of a surprise, so I figured I have to invoke the
event code from within the IDE itself. If it was just a normal macro, I
could do an IDE Run->Run Sub. But that won't work - I don't have a macro
defined that I can run - the blooming code is an event handler.

And there I'm stuck. Any suggestions?
 
S

Steve Rindsberg

Do I need to reboot after the reg edit?

No ... but since you'd mentioned an addin, I ass-u-med PPA.
You wouldn't see any changes with code in PPTs.

Working with a PPA, I can definitely set a breakpoint in the event handler code
and step through from that point when the event fires (and just in case, I just
doublechecked this in 2007; works there too).

But in either PPT/PPA if you stop the code running in the debugger or hit an
unhandled error, it releases the event trap. You've got to reset that before
events will fire again. From your description, though, that seems not to be
the problem.
 
G

Guest

It's definitely a .ppam (add-in) and I know the event fires.

Thinking back, I think I asked you about this maybe a year ago, when I was
on 2003, and I couldn't get it to work then, either. Any diagnositc
procedures you can suggest to help me figure out what's usurping my
breakpoint? Are there some secret debugger parameters that govern whether
the debugger works in event handlers?
 
G

Guest

Ok - head-slap time.

First of all, the event debugging works just as you said it does.

Second of all, I was trying to debug Windows events that were not triggered
from within the rest of my VBA code -- PresentationBeforeSave, e.g. I
inserted a Save in one of the macros, and when I executed that - voila!

But what I *really* want to do is debug some code that fires when a shape is
double-clicked. Is it possible to simulate a single- or double-click in
code? I think I have seen that question asked many, many times and don't
recall ever having heard or seen a good, crisp answer.

As always, thanks, Steve.
 
S

Steve Rindsberg

Dave Jenkins said:
Ok - head-slap time.

Better you than me, sir. My ears are ringing hard enough already from past
transgressions. ;-)
But what I *really* want to do is debug some code that fires when a shape is
double-clicked. Is it possible to simulate a single- or double-click in
code? I think I have seen that question asked many, many times and don't
recall ever having heard or seen a good, crisp answer.

You can trap the selection event to run code when something is singleclicked
but I don't know of any way to deal with doubleclicks.

Hello Chirag???
 
C

Chirag

Steve Rindsberg said:
Jenkins
wrote:

Better you than me, sir. My ears are ringing hard enough already from
past
transgressions. ;-)


You can trap the selection event to run code when something is
singleclicked
but I don't know of any way to deal with doubleclicks.

Hello Chirag???

Is this in Slide design views or during Slide Shows?

- Chirag

Shortcut Manager - Assign keyboard shortcuts to menu items and macros
http://officeone.mvps.org/ppsctmgr/ppsctmgr.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top