Hi all,
I'm stuck trying to decide if the user selected a group of objects or nothing. If they select nothing, then I will search the active layer for the shapes. The problem is that if they selected it, it's a "ShapeRange", but if I grab all the shapes on the page, it's "Shapes". I originally tried to call them both "AllShapes", but since they are different types, I have to used different names. Once I get to the For loop, I need to decide to use "OrigSelection" or "AllShapes". Is there an easy way to choose which variable to use, or is there a way to call them both "AllShapes" so I can just use the same name in the For Loop?Dim shpCheck As ShapeDim OrigSelection As ShapeRangeDim AllShapes As Shapes Set OrigSelection = ActiveSelectionRangeIf OrigSelection.Count < 1 Then Set AllShapes = ActivePage.ActiveLayer.ShapesEnd If
For Each shpCheck In AllShapes 'Or I have to call OrigSelection if the used made a selection. <...do stuff...>next shpCheckJoseph
If <…do stuff..> is same for what is selected then you can try to change
If OrigSelection.Count < 1 Then Set AllShapes = ActivePage.ActiveLayer.ShapesEnd If
To
If OrigSelection.Count < 1 Then Set OrigSelection = ActivePage.ActiveLayer.ShapesEnd If
Did you try "Shapes.All" method to select all shapes as a ShapeRange?
In your example it should read like this:
If OrigSelection.Count < 1 Then Set OrigSelection = ActivePage.ActiveLayer.Shapes.AllEnd If