VBA - index of selected table-shape

G

Guest

dear ng again,

i need the actualy index of an selected table-shape. how can i read them?

i need them, to format the table automaticly like...

With sSh.Table
For iRow = 1 To .Rows.Count
For iColumn = 1 To .Columns.Count
......

it works, if i do it like this...
Set sSh = ActivePresentation.Slides(1).Shapes(1)

....if on Slide 1 is only an table. but i need the actualy, selected
table-index.

thanks and regards
Siberianhusky
 
S

Steve Rindsberg

Siberianhusky said:
dear ng again,

i need the actualy index of an selected table-shape. how can i read them?

i need them, to format the table automaticly like...

With sSh.Table
For iRow = 1 To .Rows.Count
For iColumn = 1 To .Columns.Count
......

it works, if i do it like this...
Set sSh = ActivePresentation.Slides(1).Shapes(1)

....if on Slide 1 is only an table. but i need the actualy, selected
table-index.


Set sSh = ActiveWindow.Selection.ShapeRange(1)
With sSh.Table
' etc
 
G

Guest

thank you, but the ShapeRange(1)-Index is not allways the number one. i need
the aktually, selected index of the shape!

regards
Siberianhusky
 
G

Guest

thank you.
i now those examples, but in all them are fix shape-indexs. i need the
aktually selected shape-index wich the user has selected!

for example - the aktually slide-nummber:
iSlideNumber = ActiveWindow.Selection.SlideRange.SlideIndex

but i cann't find the index for the selected shape. who can help? thanks.

regards,
Siberianhusky
 
G

Guest

i get it!

sShape = ActiveWindow.Selection.ShapeRange.Name
Set sSh =
ActivePresentation.Slides(ActiveWindow.Selection.SlideRange.SlideIndex).Shapes(sShape)

regards,
Siberianhusky
 
G

Guest

i get it! -->

sShape = ActiveWindow.Selection.ShapeRange.Name
Set sSh =
ActivePresentation.Slides(ActiveWindow.Selection.SlideRange.SlideIndex).Shapes(sShape)

regards,
Siberianhusky
 
S

Steve Rindsberg

Siberianhusky said:
thank you, but the ShapeRange(1)-Index is not allways the number one. i need
the aktually, selected index of the shape!


Don't criticize it until you've tried it. ;-)

The code I quoted *does* give you the selected shape, NOT shape number one on the
slide.

ActiveWindow.Selection.ShapeRange returns a shapeRANGE that represents the current
selection. Since that may be one or more shapes, I tend to use ShapeRange(1),
meaning the first shape in the current selection. That returns a shape rather than
a shaperange (important for some code to work).
 

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