> I am using a dynamic array with a variable number of elements to describe
> several shapes on a page. When I go to group the shapes using
>
> (Some variable references omitted for space)
>
> CurrentPage.Shapes.Range(Index:=ShapeArray()).Group
Is ShapeArray() an array of Publisher.Shape objects?
> it gives me a "SubScript out of range" error. After adding a watch and
> several breaks concerning the Array, it is adding the shape names correctly.
> All elements are filled and none are missing. Am I referencing the array
> incorrectly or what? The only examples I have seen have things like
> .Shapes.Range(Index:=Array("Shape1", "Shape2", "Shape3").Group
Sadly a lot of the code examples do this; they're rarely relevant.

Signature
Ed Bennett - MVP Microsoft Publisher
http://ed.mvps.org
Cory - 23 May 2007 18:17 GMT
I figured it out:
I Dim-ed ShapeArray() originally as String for whatever reason. I was
putting strings into it, but it would not pass those to the Range method in a
way that it would understand them and build the range. I went back and
changed it to Variant and it works. The extra runtime (because the system
has to assign a data type) is so negligible that it is unnoticed, so it is
alright. I can assume that it should have been Array or something?
Cory
> > I am using a dynamic array with a variable number of elements to describe
> > several shapes on a page. When I go to group the shapes using
[quoted text clipped - 12 lines]
>
> Sadly a lot of the code examples do this; they're rarely relevant.