Name of the objects and Object types

H

Hari Prasadh

Hi,

I have primarily used Excel (with a little VB).
This is my introduction to powerpoint.

I am copying some ranges (containing some text) from Excel and pasting in to
powerpoint.

I want to copy this text from excel and paste it within a specific textbox
within a powerpoint template.

How do I know the name of the textbox in the powerpoint template.

I see that if I run some dummy macro recording's then I get some code like
ActiveWindow.Selection.SlideRange.Shapes("Text Box 8").Select

Is there a more efficient way of knowing the name of the objects and object
numbers in powerpoint(rather than recording macros for each object and
seeing the description inside Shapes("Text Box 8"). )

Also, is there a separate group for powerpoint programming? (My OE doesnt
say so)

Thanks a lot,
Hari
India
 
S

Shyam Pillai

Hari,
You don't need to know the name of the shape enter text into it. You can use
the index number of the shape too.
ActiveWindow.Selection.SlideRange.Shapes(1).TextFrame.TextRange.Text = "This
is a test.
' Assuming that you intend to paste the text from the clipboard.
ActiveWindow.Selection.ShapeRange(1).TextFrame.TextRange.Paste

I would recommend that you spend some time visiting the pages at the
following sites: http://skp.mvps.org and the programming section of the
PowerPoint Faq - www.pptfaq.com
 
H

Hari Prasadh

Hi Shyam,

I have gone through your site and found syntaxes in the newbie section
useful to me.

My following question would be a very naive one for you. You have asked me
to use the index number of the shape. How would it be possible for me to
know the index number of the shape non-programmatically. Please guide me.

Analogy is that in Excel if I have a embedded chart and if I keep the Ctrl
pressed and select one of the chart, Name-Box would say Chart 1 or Chart 2.
Do we have such Name-Boxes in Power-point?

(Please note , programmatically I have been able to know the index number of
the shape in an indirect manner by using the Sub
Object_Types_on_This_Slide() from rpdslides.com -- FullFaq's list)

Thanks a lot,
Hari
India
 
H

Hari Prasadh

Hi Shyam,

Im sorry. Even programmatically Im not able to find the shape number --
Shapes(1) -- as the macro Object_Types_on_This_Slide() from rpdslides.com
gives me the type number and the name of the object but not the shape
number.

Please tell me the syntax for finding the shape number of an object
programmatically. (also for finding the same non-programmatically)

Thanks a lot,
Hari
India
 
S

Shyam Pillai

Hari,
The index number corresponds to the z-order position of the shape on the
slide. The bottom most shape will have the index as 1 and the top most shape
as N where N = number of shapes on the slide. You can ascertain the index
number by making use of a hidden utility - Select Multiple Object.

1. Select Tools | Customize..| Commands Tab.
2. Under catergories click on 'Drawing'.
3. Draw 'Select Multiple Objects' command from the right column to a toolbar
of your choice.
4. Close the Customize dialog.
5. Click on the new command button you've added.

This will enumerate the shape in order of their index numbers.
Do we have such Name-Boxes in Power-point?
Not quite, but you can download my free rename add-in which has a name box.
Download it from here: http://skp.mvps.org/download.htm

--
Regards,
Shyam Pillai

Handout Wizard: http://skp.mvps.org/how
 
H

Hari Prasadh

Hi Shyam,

Im sorry .. -- shapes(i) -- is there in the code of
Object_Types_on_This_Slide() from rpdslides.com
So Im able to find the shape number programmatically by using -- Msgbox i --

Thanks a lot,
Hari
India
 
H

Hari Prasadh

Hi Shyam,

Select Multiple Object is a nice method to know about the index number.

But based on your -- The bottom most shape will have the index as 1 and the
top most shape as N where N = number of shapes on the slide. -- I have new
doubts.

In the first slide of my presentation I have 3 shapes and all these 3 are
text-boxes.

When I click on the Select multiple objects, then I have 3 checkboxes within
that:-
Text Box 8: Hello
Text Box 9: World
Text Box 10: Bye

My doubt is that if there are only 3 shapes then why are the numbers above
8, 9 and 10 instead of 1, 2 and 3?
Morever the text in the top most text-box is hello, while the text in the
middle text-box is world and the text in the third text-box is Bye. So why
is the select multiple option utility giving a higher number to the
bottom-most text-box.

(I have Office XP and Win XP.)

Thanks a lot,
Hari
India
 
H

Hari Prasadh

Hi David,

Thnx a ton for the link.

I went through all the example powerpoint files in your site and pinched
some of the syntaxes in them for my needs.

Regards,
Hari
India
 
H

Hari Prasadh

Hi Shyam,

I see that Select multiple objects is a GREAT way to select *hidden*
objects. Like I was just playing around and had a rectangle and over it I
created a big table which hid the rectangle from view and using the multiple
object view I could select the rectangle and edit the Text in that.

Just wanted to know this. Is there any other non-programmatic way to
accomplish the above. (Programmatically I can do it based on swiping codes
from here and there.)

Thanks a lot,
Hari
India
 
D

David M. Marcovitz

If you really want to know the number of a shape, here is how you do it:

If you are using PowerPoint 2002 or 2003, go to the Tools menu and choose
Options. Click on the Edit tab, and check the box under Disable new
features for the new animation features. This step is unnecessary in
PowerPoint 2000 or 97.

Now, go to the SlideShow menu and choose Custom Animation. Click on the
Order and Timing tab. Look in the upper left corner of the dialog box,
and you will see all the shapes on the slide. Ignore the names of those
shapes (they are not the real names of the shapes), but they are followed
by a number. That number is the Index number of the object.

As earlier posts have mentioned, using the number is not reliable because
it can change as objects are added to and deleted from your slide.

--David

--
David M. Marcovitz
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.loyola.edu/education/PowerfulPowerPoint/
 
H

Hari Prasadh

Hi David,

Thnx a lot for a step by step explanation.

You (and everybody else) have advised to not use the number of a shape as
addition / deletion of new objects will change the shape number.

I have one doubt based on above. Iam quoting Steve R here-- If you change
the order of the shapes (Draw, Order, Send to back, etc) then index changes
but not the name. -- Then if I use Index number in my program wouldn't it go
wrong if the order of the shapes was changed by somebody prior to the
running of the macro?.

In all what number would be the best choice for programmatically refferring
to a shape?

Thanks a lot,
Hari
India
 
D

David M. Marcovitz

The best thing to do is to use the name, particularly if other users
might mess with stuff. Note that there are a couple of numbers of
interest. The index number is just a plain number, used as:

ActivePresentation.SlideShowWindow.View.Slide.Shapes(3)

That gives you the third shape on the current slide. That number is
subject to change.

Another number you will see is part of the name as in:

ActivePresentation.SlideShowWindow.View.Slide.Shapes("AutoShape 3")

That gives you a shape named "AutoShape 3" on the current slide. That
number is assigned to the name when the shape is created, and it never
changes (unless you change it). It is just used by PowerPoint to insure
that it is not creating shapes with the same name on the same slide.

--David

--
David M. Marcovitz
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.loyola.edu/education/PowerfulPowerPoint/
 
S

Shyam Pillai

Things to remember when referring to shape by their names:
1. Bug in PowerPoint: If you have renamed a shape using vba, a copy/paste of
that shape will create a shape with the same.
2. I've seen presentations where a call to get the reference to a shape by
name will fail even if the shape with that name exists. Hence I've given up
on using names. If you are deploying your code to several machines, I'd urge
you to do so. For simple purposes using names is just fine.

--
Regards,
Shyam Pillai

Handout Wizard: http://skp.mvps.org/how
 
H

Hari Prasadh

Hi Shyam,

Thnx for giving me the below info. Would be careful about the same.

Thanks a lot,
Hari
India
 
H

Hari Prasadh

Hi Steve and David,

Thnx for clearing all my doubts regarding Name and Index numbers.

Regards,
Hari
India
 
H

Hari Prasadh

Hi,

Since, the present lot of doubts seemed to be more or less related to the
original post, I did not resort to a new thread.

I open a new PPT session from Start - Programs.

I get a blank presentation with one slide, where there is one dotted
rectangle border with -- Click to add title-- and another dotted rectangle
border saying -click to add subtitle--

STEP 1 - I click on select multiple object menu shortcut and I see that
these 2 dotted rectangle border shapes are called as Rectangle 2 and
rectangle 3.

STEP 2 - Then I went to the drawing toolbar and clicked on rectangle shape.
In -- select multiple objects-- menu bar it's name is displayed as Rectangle
4

STEP 3- Then I went to Insert and selected a Text Box and drew the same on
the first slide. As soon as I unselected the textbox it was no longer on the
slide. I checked -- select multiple objects-- menu bar and it displayed
text-box as being not there on the slide.

STEP 4 - Since in STEP 3 I couldnt get a textbox so this time before
unselecting the text-box I wrote some text inside it.In -- select multiple
objects-- menu bar it's name is displayed as Text-Box 5.

STEP 5 - I go to --Slide show -- Custom animation - and within check to
animate slide objects I get the following four objects (in order ) -- Title
1 , Text 2 , Rectangle 3 and Shape 4 . By checking the check boxes in the
custom animation dialog box I note that MAPPING between the display names in
Cutom animation dialog box and the names in the select multiple objects is
:-
Title 1 is actually Rectangle 2
Text 2 is rectangle 3
Rectangle 3 is rectangle 4
Shape 4 is TextBox 5

Couple of naive doubts based on above.

a) Since I opened a new PPT session, why should PPT give the numbers as 2
and 3 instead of 1 and 2 in STEP 1. Any reason behind the same?

b) In STEP 2 I created a rectangle from drawing toolbar and in STEP 4 I
could create a Text-Box. Whats the difference between a Text-Box and a
rectangle. In what situation does one use a text-box and when a rectangle?.
I see that I cannot write anything within a rectangle. So, when we create a
flow-chart kind of thing using this rectangle do I have to use a textbox
over a rectangle in order to give the illusion of text written inside a
rectangle? Are there any better/other ways?

c) I see that in a text-box the outer line/border is not visible while in a
rectangle it is visible. Again the 2 shapes from STEP 1 have dotted border.
What does one do in powerpoint which requires these 3 shapes to have
different kind of border characteristics? Again if i write something within
the shapes of STEP 1 the doted border vanishes. what's the logic behind the
same. (ok, to some extent I can appreciate rectangle having border as that
would be needed in a flow-chart kind of situation. Other that is rectangle
of any use?)

d)In STEP 3 the textbox vanishes if I dont write anything inside it while it
stays put if I write something as in STEP 4. Why has it been designed in
such a manner?

e) I see that STEP 2 rectangle and STEP 4 text-box have a green handle when
I select them and with it I can rotate them to any angle. On the other hand
the STEP 1 rectangle dont have that green handle. Why is it so?

g) If in -- Select multiple objects-- menu bar displays the same name which
is Rectangle for both STEP 1 and STEP 2 objects then why are they having
different characteristics in terms of border/green hande etc? Please note as
of now I havent changed their names using Shyam's add-in, so I belive that
if Powerpoint by default shows something as rectangle then it must be a
rectangle. Is that a valid assumption?

h) Based on the DISPLAY name differences between custom animation dialog box
and select multiple objects menubar in STEP 5, I have some sub-questions:-
1) I understand that programmatically if I want to refer to a shape then
for small - scale purposes I would stick with the names in the select
multiple objects. But my doubt is ... is it posssible for a person to second
guess the name (not the number) which will be displayed in the custom
animation dialog box based on the default display name in the select
multiple objects. It's because in one of the posts David M said -- Ignore
the names of those shapes (they are not the real names of the shapes), but
they are followed by a number. That number is the Index number of the
object. -- So on what basis does Power-point assign names in the cutom
animation dialog box.
2) Is it possible for a person to know non-programmatically what is the
type/kind of a object. Like is it possible for me to second-guess by
clicking on a particular shape or by selecting some menu option whether a
particular shape is actually a text-box kind of shape or a rectangle kind of
shape. Between text-Box and rectangle difference would be that I cannot
write inside the later, but what about the huge number of shapes provided in
powerpoint, how do I know what type they are non-programmatically?

Please guide me.

Thanks a lot,
Hari
India
 
H

Hari Prasadh

Hi Steve,

Thnx a TON for point by point explanation. Im that much RICHER.
You can, by the way, enter text within a rectangle. Click it, start
typing.
I still suffer from the hangover of double-clicking a cell in Excel in order
to enter text in to a cell. If I do a single-click in a cell then the
present cell's contents would be lost. Hence, in Excel I always prefer
double-click in order to enter data. So when working with objects in
powerpoint I was doing the same double-click. In a text-box if I do a
double-click it would let me enter text (though the complete text within
text-box would get highlighted- which is undesirable if one wants to append
text), but when I did the same with rectangle then the Format Auto-shape
dialog pops up. I didnt realise that if I do a single-click within rectangle
one could write to my hearts content. So, to add to the differences between
a rectangle and text-box -- If it sticks around for more abuse, it's a
rectangle. -- one cannot enter text within a rectangle with double-click,
while in a text-box one can.
I would like to dwell a little bit on knowing the object type for any
GENERAL object. Like if a third person has made a powerpoint presentation
using a autoshape of -- stars and banners -- and within it Explosion1 and if
there is another autoshape of -- stars and banners -- and within it
Explosion 2, then how would a person like me know non-programmatically what
objects they are. (I have got the code for programmatic determination).

Let me give you an analogy with Excel. Suppose if a third person applies a
color pattern (background color) to a cell and if I want to know what color
it is then one can do it programmatically. Again non-programmatically if one
wants to determine it, one can activate the cell and then go to the tool-bar
and click on the Fill Color dropdown menu and then HOVER over the ACTIVE
color in the drop-down menu. One would get a "Tool-tip" telling us the name
of the color.

So I thought PPT might be having a "similar way" (aka Tool-Tip) to indicate
the name of the object. I drew 2 or 3 shapes in random (let's say
Explosion1) and then clicked one of them and then went to the
auto-shapes-stars and banners.. but within that explosion one is not Active.
If it had been active then it would have been one way by which a person
could know the name of any object. But again one would have to go to each of
the sub-menu to find out whether one of the entries is active.

Please note Im not actually using the multitude of shapes available in PPT
but just from the viewpoint of easily recognizing objects created by other
person (and yes Knowledge for the joy of learning). Hence , my original
query ... Is it possible one to easily second-guess the type of a object
whether by clicking a menu-option or something similar. Is that facility
inbuilt in PPT (Other than the possibility of developing an add-in which
would imitate the ability)

Thanks a lot,
Hari
India

news:[email protected]...
 

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