Build array of Shape Names With VBA

C

ciw2otv

During slide show mode, individual shapes are made on a slide with
AddShape(,,,,) and each given a name with Name = "Sleepy", Name =
"Dasher", etc. All shapes are created by referencing the left, top
point of the slide(0,0 -- cuts done on the math for me.) Once all of
the shapes are formed in their position relative to each other, it
would be nice to move them out in the center of slideland. Can an array
be generated during this process, or after all have landed on the seen,
or is there a better way. All objects on the slide will be included in
this trek.
Thank you,
Eldon
 
B

Bill Dilworth

There is already an array of shapes names available to you (of sorts).

The shapes on a slide are numbered and they can be referenced by these
numbers also. Look at the code below to see how you can grab all the shape
names (if they are really needed) from Slide 1.

===Begin Code===
Sub Toponymy()

Dim x As Integer
Dim strName() As String

With ActivePresentation.Slides(1)

For x = 1 To .Shapes.Count
ReDim Preserve strName(x) As String
strName(x) = .Shapes(x).Name
Next x

Dim MyText As String
For x = LBound(strName()) To UBound(strName())
MyText = MyText & strName(x) & vbCr
Next x

End With

MsgBox MyText
End Sub


===End Code===

--
Bill Dilworth
A proud member of the Microsoft PPT MVP Team
Users helping fellow users.
http://billdilworth.mvps.org
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
vestprog2@ Please read the PowerPoint FAQ pages.
yahoo. They answer most of our questions.
com www.pptfaq.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