Hi all,
I need to group a decent sized selection of shapes (25) and apply a name. I've been successful doing this using the long, brute force approach below:
wsDwg.Shapes.Range(Array(myRow & "TITLE", myRow & "CP", myRow & "CPK", myRow & "CHART", myRow & "BAR1", myRow & "BAR2", myRow & "BAR3", myRow & "BAR4", myRow & "BAR5", myRow & "BAR6", myRow & "BAR7", myRow & "BAR8", myRow & "BAR9", myRow & "BAR10", myRow & "BAR11", myRow & "BAR12", myRow & "BAR13", myRow & "BAR14", myRow & "BAR15", myRow & "BAR16", myRow & "BAR17", myRow & "BAR18", myRow & "BAR19", myRow & "BAR20", myRow & "MINLINE", myRow & "MAXLINE", myRow & "BlockCover")).Group.Name = myRow & "BlockGroup"
As you can see, this is messy and prone to typos. If I need to change anything it will be easy to break and difficult to troubleshoot. Since the call is using the "Array" function, I would like to build a 1-dimensional array and just call that instead. Here's the array I built:
shapeArray(1) = myRow & "TITLE"
shapeArray(2) = myRow & "CP"
shapeArray(3) = myRow & "CPK"
shapeArray(4) = myRow & "CHART"
For i = 1 To 20
shapeArray(i + 4) = myRow & "BAR" & i
Next
shapeArray(25) = myRow & "BlockCover"
The problem is I've not been successful calling my "shapeArray" in the Shapes Range function from the original line. Can anyone help with the correct syntax to use in this situation?
Bookmarks