Macro: testing for existence of shape

S

simonc

I'm writing a macro to take a list of report figure numbers from an Excel
spreadsheet and go through a powerpoint presentation adding the figure number
in a text box on each slide. If the macro has been run previously the text
boxes to hold figure numbers will already exist and in that case I only want
to update the text, not create a new text box. How can I test if the figure
number text box already exists? Can you assign a text box an identification
name? Is there some other way of identifying objects on powerpoint slides?

Grateful for advice
 
D

David M. Marcovitz

You can set the name of a shape:

oShp.Name = "MyName"

There are other ways to do this as well. Just beware that PowerPoint gets
cranky if two shapes on the same slide have the same name, so be sure to
do your checking before assigning a name.

--David

--
David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top