RE: vba to select multiple shapes on a drawing canvas

Tech-Archive recommends: Speed Up your PC by fixing your registry



That's an excellent point...I'll add that line of code.
if intSelTxtBx >= 4 then
...
end if

--
Thanks again!
Mona-ABE


"old man" wrote:

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
.



Relevant Pages

  • RE: vba to select multiple shapes on a drawing canvas
    ... check if intSelTxtBx has a value of 4 or more before you select the shapes. ... A canvas is just another shape in word. ... This assumes the first shape in the document is a canvas and has at least ... Dim myDoc As Document ...
    (microsoft.public.word.vba.general)
  • RE: vba to select multiple shapes on a drawing canvas
    ... A canvas is just another shape in word. ... This assumes the first shape in the document is a canvas and has at least ... Dim myDoc As Document ... Dim shpCanvasShapes As CanvasShapes ...
    (microsoft.public.word.vba.general)
  • Re: Word Shapes and Drawing Canvas
    ... Dim srange As ShapeRange ... MsgBox "This canvas contains no callouts to format." ... Doug Robbins - Word MVP, ...
    (microsoft.public.word.vba.general)
  • Re: Word Shapes and Drawing Canvas
    ... Dim srange As ShapeRange ... MsgBox "This canvas contains no callouts to format." ... > and boxes) that are in a canvas, but each canvas has to be selected ... I am trying to change the color of all Word Shapes ...
    (microsoft.public.word.vba.general)
  • Canvas tp display audio waveform
    ... I've had limited success displaying the audio waveform of a 16 bit ... Neither do I know how to draw sine waves. ... In a window with a pushbutton, a listbox and a canvas on it I use this ... dim f As FolderItem ...
    (comp.lang.basic.realbasic)