Solved

Very Final Powerpoint Macro Question

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Where is user Lync data stored 4 81
Office 365 home questions 7 65
Office 2016 or Office 2010 for new Dell Precision 5810 workstation? 6 35
Automatic sort formula 8 49
Microsoft Office Picture Manager is not included in Office 2013. This comes as a shock to users upgrading from earlier versions of Office, such as 2007 and 2010, where Picture Manager was included as a standard application. This article explains how…
Microsoft Office Picture Manager was included in Office 2003, 2007, and 2010, but not in Office 2013. Users had hopes that it would be in Office 2016/Office 365, but it is not. Fortunately, the same zero-cost technique that works to install it with …
This video shows and describes the main difference between both orientations in Microsoft Word. Viewers will understand when to use each orientation and how to get the most out of them.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

813 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

16 Experts available now in Live!

Get 1:1 Help Now