Solved

Very Final Powerpoint Macro Question

Posted on 2011-02-25
2
352 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Having trouble getting your hands on Dynamics 365 Field Service or Project Service trial? Worry No More!!!
Cancel future meetings from user mailboxes in Office 365 using Remove-CalendarEvents
This video walks the viewer through the process of creating Hyperlinks for the web and other documents. Select the "Insert" tab: Click "Hyperlink":  Type "http://" followed by a web address to reference a website or navigate to a document to ref…
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …

617 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