PDA

View Full Version : Debugging VBA?



g3nrw
06-23-2012, 05:37 AM
Trying to debug VBA code. PowerPoint 2003 under Windows XP.

When I run the code in the *code* window, I can set breakpoints. step through the code and have the VBA interpreter alert me to any VBA code errors. Everything works as I expect.

But when I start the code from the *slide* window, breakpoints are ignored, and no errors are reported.

How can I persuade PowerPoint to stop when a breakpoint is reached, and tell me when there are errors, when running the code from the slide window?

--
Ian

g3nrw
07-01-2012, 11:21 PM
Anna

I do not understand your reply at all. Could you please re-phrase it.

Thank you.

--
Ian

John Wilson
07-01-2012, 11:47 PM
I think you'll find it's not an attempt to be useful just spamming to get their link posted.

Break points do normally work in slide show mode - are you sure your code is compatable with slide show view? (If you used the recorder it's unlikely that it will be)

g3nrw
07-02-2012, 01:58 AM
John

Reminder. I am using PPT 2003, if that makes any difference.

I just created a brand new PPT show, containing a single action button. The Action Setting is linked to mybutton_click:



Sub mybutton_click()

Dim n As Integer
n = 0
n = n + 1

MsgBox "Button clicked"

End Sub


If I put a breakpoint at n=n+1 and run in the code page, it stops at the breakpoint as expected. But if I run as a slideshow and click on the button, the program does not stop at the breakpoint, but goes on to display the message.

--
Ian

John Wilson
07-02-2012, 02:43 AM
Weird

I ran your code in 2003 and it stopped at my breakpoint on n=n+1. I have seen other people complaining that breakpoints were ignored in show mode but it doesn't happen here. Not sure what to suggest.

g3nrw
07-02-2012, 05:54 AM
John

Could it be that I am missing an add-in? I had to install the Auto-Events add-in to make my program start properly on opening the slideshow. Maybe I need to do something similar to make breakpoints work in slideshow mode.

(I am used to them working in Excel and Word when running code from the app window, and I certainly miss them in PowerPoint!).

--
Ian