Word 2003 VBA - program access to position of Shapes within a Canvas ? - TechRepublic
Question
September 6, 2010 at 12:56 PM
aeggie

Word 2003 VBA – program access to position of Shapes within a Canvas ?

by aeggie . Updated 15 years, 10 months ago

Hello,

In word 2003, I am trying to work programmably on shapes placed within a canvas.

Creating them in the right position in the canvas is ok:
With shpCanvasShapes
Set newshape = .AddShape(msoShapeRectangle, 50, 50, 100, 200)
MsgBox newshape.Name
End With

However, I cant figure how to programmably test or modify their position relatively to the canvas they are placed in…

With ActiveDocument.Shapes(“canvas 2”).CanvasItems
Set newshape1 = .AddShape(msoShapeRectangle, 50, 50, 100, 200)
MsgBox newshape1.Name & vbTab & newshape1.Left
Set newshape2 = .AddShape(msoShapeRectangle, 100, 50, 100, 200)
MsgBox newshape2.Name & vbTab & newshape2.Left
End With

The “left” property always give me the left position of the canvas (same value for both new shapes) not of the shape by itself !

Does someone know the function / property / trick for reading and modifying the individual position of each CanvasShape / CanvasItem ?

Thanks a lot in advance
Aeggie

This discussion is locked

All Comments