VBA to AlignCenters without select

  • Thread starter Thread starter Barb Reinhardt
  • Start date Start date
B

Barb Reinhardt

I prefer not to have to select objects when I do something with them. How
do I change this

myShape.Select
With Application.ActiveWindow.Selection.ShapeRange
.Align msoAlignCenters, True
End With

so that I can act on myShape, and not on the selection?
 
The problem is that Align acts on a ShapeRange, not a Shape. For
anything you want to do to a single shape:

myShape.Whatever

will work.

If you can put myShape into a ShapeRange (which is what the selecting is
doing) then you can do myShapeRange.Align.msoAlignCenters, True

--David

--
David M. Marcovitz
Microsoft PowerPoint MVP
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/

=?Utf-8?B?QmFyYiBSZWluaGFyZHQ=?=
 
So how do I put myShape into a shaperange? Can it be done?
Thanks,
Barb Reinhardt
 
Dim oRng as ShapeRange
'-----
'-----
Set oRng = ActivePresentation.Slides(1).Shapes.Range(Array(MyShape.Name))

With oRng
.Align msoAlignCenters, True
End With

Regards,
Shyam Pillai

Image Importer Wizard
http://skp.mvps.org/iiw.htm
 
Thanks for jumping in Shyam, I haven't had time to check the newsgroups
in a few days.
--David
 
Back
Top