Solved

Very Final Powerpoint Macro Question

Posted on 2011-02-25
2
349 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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Many programs have tried to outwit PowerPoint in terms of technology and skill. These programs, however, still lack several characteristics that PowerPoint has possessed from the start. Here's why PowerPoint replacements won't entirely work for desi…
PowerPoint is the go-to presentation software for millions of users around the world. Many presentations use basic text features but you can really make special text jump out of your slide by applying this bubble text design process. This article ha…
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

820 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