gravanoc
Active Member
- Joined
- Oct 20, 2015
- Messages
- 351
- Office Version
- 365
- Platform
- Windows
- Mobile
I'm trying to create a ShapeRange from a number of shapes without knowing how many until runtime.
The method I'm using to create the ShapeRange is [Sheet Name].Shapes.Range(Array([Shape 1].Name, [Shape 2].Name, ... [Shape n].Name))
For ex:
I haven't been able to make it work dynamically. One method I tried was constructing a string with the names of the shapes and placing the string in Array().
I don't see a method for ShapeRange that allows me to add shapes to it, either.
The method I'm using to create the ShapeRange is [Sheet Name].Shapes.Range(Array([Shape 1].Name, [Shape 2].Name, ... [Shape n].Name))
For ex:
VBA Code:
Dim sR as ShapeRange
Dim shpTable(0 to 1) As Shape
Set shpTable(0) = wks.Shapes("Shape 1")_
Set shpTable(1) = wks. Shapes("Shape 2")
Set sR = wks.Shapes.Range(Array(shpTable(0).Name, shpTable(1).Name))
I haven't been able to make it work dynamically. One method I tried was constructing a string with the names of the shapes and placing the string in Array().
I don't see a method for ShapeRange that allows me to add shapes to it, either.