Does anyone know a way of grouping objects, e.g. a textbox, other than using
the name of every object in an array?
I am creating a lot of textboxes in a for-loop, so I have no idea, how many
boxes, that are created.
I am running Word 2000, VBA 6.0
My code looks kind of like this:
Dim Leaves() As Shape
(lot of code)
redim leaves(imax) as shape
for ix = 0 to imax 'imax migth be 0, so the code must be dynamic
Set Leaves(ix) = ActiveDocument.Shapes.AddTextbox(...)
Next ix
ActiveDocument.Shapes.Range(Array(Leaves(0).Name,
Leaves(1).Name,Leaves(2).Name )).Group
' This will not work, as I don't know, how many textboxes there are.
C. Østergaard
Peter Jamieson - 23 Jan 2006 10:49 GMT
Although the parameter for the Range method is a Variant array, you should
also be able to use an Array of Variants, e.g. something like
Dim Leaves() As Shape
Dim LeafArray() As Variant
(lot of code)
redim leaves(imax) as shape
redim LeafArray(imax) As Variant
for ix = 0 to imax 'imax migth be 0, so the code must be dynamic
Set Leaves(ix) = ActiveDocument.Shapes.AddTextbox(...)
Next ix
ActiveDocument.Shapes.Range(LeafArray).Group
Peter Jamieson
> Does anyone know a way of grouping objects, e.g. a textbox, other than
> using
[quoted text clipped - 18 lines]
>
> C. Østergaard
CØstergaard - 23 Jan 2006 13:43 GMT
Thanks for the help, it worked
> Although the parameter for the Range method is a Variant array, you should
> also be able to use an Array of Variants, e.g. something like
[quoted text clipped - 34 lines]
> >
> > C. Østergaard