Steve,
Thanks for your reply, but a few things remain unclear to me. The question
is, how do I know which shape is "ShapeRange(1)"? Is the code you provided
something that runs at design time, such that I have to run it somehow when a
particular shape is selected?
Right. The first line of code simply lets you set the name of a selected shape so
that you can access it later using code like that in the next few lines of code.
By giving the shape a name in advance, it's much simpler to manipulate it directly
later rather than keeping track of numbers.
On my slide, I could have as many as 20 or more rectangles or other objects
that I need to manipulate. How do I know ahead of time how to refer to it so
that I can change its properties? Which one is "ShapeRange(1)"?
You tell me. <g> What are the criteria you use to determine what needs to be
manipulated and what doesn't?
You might want to pre-name the shapes so you can manipulate them directly
You might want to check all of the shapes on a slide and change only the ones that
meet some set of criteria - find all the RGB(0,0,255) ones and move them into the
upper left corner, for example.
You might want to get the first shape on the slide and make it the last or vice
versa.
Also, does "Slides(1)" refer to the "page number" of the slide, or its name
in the properties window within the VBA editor?
It refers to the slide's .Index property ... that is the ordinal number of the slide
within the presentation. In short, if it's the second slide in the presentation,
it will have an .Index property of 2, so it'd be .Slides(2)
From within the VBA editor,
slides seem to be named almost randomly: slide42, slide 247, slide 63.
They're given names in order of creation, but if somebody reorders the slides in the
presentation, the names don't change to reflect that.
These things have baffled me for awhile now, and no amount of reading I have
done on the Microsoft web site (or any other) has been able to clear things
up for me.
Microsoft could have made this so much easier if all objects on a slide were
treated the same way as objects on a VisualBasic form within the VisualStudio
environment.
Sure, it's always easier if the model we understand is used universally, but that
doesn't necessarily make it the best model for all possible uses. I might
understand chainsaws really well, but when the job calls for welding ... um. Darn.
;-)
But I suppose it might help to consider that:
A VB project has a forms collection; on each form there are controls and the
controls have properties. You can refer to Form(n).Controls(x).Property for
example.
In PowerPoint, a presentation has a Slides collection and on each slide there are
Shapes. You can work through Slides(n).Shapes(x).Properties in the same way.
Thanks again for your help. I really appreciate it.
No problem. I'm sure you'll have more questions ... don't hesitate.