Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / January 2006

Tip: Looking for answers? Try searching our database.

Grouping of textboxes in Word

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
CØstergaard - 22 Jan 2006 16:41 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.