I can select all objects in current layer with the following
ActiveLayer.Shapes.All.AddToSelection
but, how do I loop through all layers and add their shapes to Selection?
Use ActivePage.Layers and just ignore layers that are the Master one. I can show you in C# but I am guessing you want it in VBA
1 2 3 4 5 6 7 8
Sub testSelectAll() Dim shRGuide As ShapeRange, shRMaster As ShapeRange ActivePage.Shapes.All.CreateSelection Set shRGuide = ActivePage.Layers("Guides").Shapes.All Set shRMaster = ActivePage.Layers("Desktop").Shapes.All shRGuide.RemoveFromSelection: shRMaster.RemoveFromSelection Debug.Print ActiveSelectionRange.Shapes.Count End Sub
Depending on the content you are trying to access, you might use ActivePage.Shapes.FindShapes().
FindShapes can be recursive (dig into groups) or non-recursive, and you can use a CQL query to exclude specific content (e.g., guidelines, shapes on specific layers, shapes on locked layers, etc.).
So something such as this:
Sub select_stuff() Dim sr As ShapeRange Set sr = ActivePage.Shapes.FindShapes(, , False, "@type != 'guide' and @com.layer.isguideslayer = 'False' and @com.layer.isdesktoplayer = 'False'") sr.CreateSelection End Sub
or you can just press Ctrl-A (:
That works; thanks kindly!