Solved

Very Final Powerpoint Macro Question

Posted on 2011-02-25
2
346 Views
Last Modified: 2012-05-11
I have noticed that de-bugging code in PPT 2010 is is real pain - if an error occurs then the code just seems to stop. There is no error message indicating where the error is - is their a setting somewhere to make debugging easier?

If a piece of code is trying to update a non-existant shape for example I would like it to stop and tell me so and highlight the cause (line) of the error and not just stop and leave me wondering why - I've wriiten code in previous versions of XL and Word and this is the default behaviour - I'm not sure if this 'silent error behaviour' is a PPT thing or and Office 2010 thing.
0
Comment
Question by:KCTS
2 Comments
 
LVL 23

Expert Comment

by:JSRWilson
ID: 34979851
That seems to be the default here.
Maybe have a look what you have set in vbe>>Tools >> Options >>General but I didn't think you could disable completely
0
 
LVL 7

Accepted Solution

by:
hippohood earned 500 total points
ID: 35010318
This behaviour is certainly not a PPT general thing. I just checked on my PPT 2007 and the behaviour is as expected (code aborted, debugging proposed by VBA). Below is the example of error I generated for the test
Presentations(1).Slides(1).Shapes("nosuchshape").Delete

Open in new window


I don't think that this is Office 2010 thing either, becasue earlier I was doing macros in Excel 2010 and I would notice such problem.

There code reasons which would casue such behavior:
1) having error handlers somewhere in your code, things like
On Error Resume Next

Open in new window

You may try dropping all the error handlers to see if it would help
On Error Goto 0 

Open in new window

2) check your Error Trapping settings. In 2007 it is in VBA menu Tools\Options\General and check proper items or do it in the code
Application.SetOption "Error Trapping", 2

Open in new window

3) using an Add-Ins or com modules, which may interrupt your code in unexpected ways

You may create your own error handler, which, at least, would inform you at which module and which line the error happened by using Erl function
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
Recently Microsoft released a brand new function called CONCAT. It's supposed to replace its predecessor CONCATENATE. But how does it work? And what's new? In this article, we take a closer look at all of this - we even included an exercise file for…
This video shows where to find templates, what they are used for, and how to create and save a custom template using Microsoft Word.
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now