RE: vba to select multiple shapes on a drawing canvas by oldman
oldman
Fri Apr 13 12:26:01 CDT 2007
Hi,
Thanks for your kind words. I don't see all the code but perhaps you want to
check if intSelTxtBx has a value of 4 or more before you select the shapes.
old man
"Mona-ABE" wrote:
> You saved my life!
>
> With your excellent explanation, I put this together and it's working
> perfectly!
>
> intSelTxtBx = shpCanvasShapes.Count
>
> ActiveDocument.Shapes(strCanvas).CanvasItems.Range(Array(intSelTxtBx -
> 4, intSelTxtBx - 3, intSelTxtBx - 2, intSelTxtBx - 1, intSelTxtBx)).Group
>
> I'm so thankful for this forum, and for contributors like you!
> --
> Take care,
> Mona-ABE
>
>
> "old man" wrote:
>
> > Hi,
> >
> > A canvas is just another shape in word. The objects are child objects in the
> > canvas - lets say the canvas is the first shape in the page then this will
> > select the first two drawing objects on the canvas (shapes that are not
> > inline shapes have names automatically assigned to them and after they are
> > created you can read the name and then reassign a meaningful name through
> > vba.)
> >
> > ActiveDocument.Shapes(1).CanvasItems.Range(Array(1, 2)).Select
> >
> > Set range1 = Selection.Range
> >
> > This assumes the first shape in the document is a canvas and has at least
> > two ojects in it.
> > old man
> >
> >
> > "Mona-ABE" wrote:
> >
> > > I need to select multiple and specific shapes on a drawing canvas after they
> > > have been drawn automatically with programming (using vba).
> > >
> > > I have all the objects below defined in my code:
> > >
> > > Dim myDoc As Document
> > > Set myDoc = Application.ActiveDocument
> > >
> > > Dim myCanvas As Shape
> > >
> > > Set myCanvas = myDoc.Shapes(strCanvas) 'this is a variable supplied by
> > > the
> > >
> > > 'argument in the procedure call
> > > Dim shpCanvasShapes As CanvasShapes
> > > Set shpCanvasShapes = myCanvas.CanvasItems
> > >
> > > Dim myShape As Shape
> > > Set myShape = shpCanvasShapes.AddTextbox (or AddAnyOtherShape...........)
> > >
> > > After I've done this several times, I need to go back and "group" 5 shapes
> > > that have been drawn on the canvas programmatically. Please point me in the
> > > right direction to do this in Microsoft Word 2003.
> > > --
> > > Thanks!
> > > Mona-ABE