Creating Shapes

Word has several methods for creating shapes (that is, for adding a shape to the Shapes collection), depending upon the type of shape desired. Among the possibilities are: AddCallout, AddCurve, AddLabel, AddLine, AddPicture, AddPolyLine (polygonal line), AddTextbox, AddShape, and AddTextEffect.

Text before calling the AddPicture method

Figure B-5. Text before calling the AddPicture method

Inserting an image with AddPicture

Figure B-6. Inserting an image with AddPicture

AutoShapes

An AutoShape is a Shape object that represents a built-in drawing. To add a new AutoShape object, use the AddShape method, whose syntax is:

ShapesCollection.AddShape(Type, Left, Top, Width, Height, Anchor)

The parameter Type is the type of AutoShape to create. It can be any one of the MsoAutoShapeType constants:

msoShape16pointStar (94)

msoShapeActionButtonHelp (127)

msoShape24pointStar (95)

msoShapeActionButtonHome (126)

msoShape32pointStar (96)

msoShapeActionButtonInformation (128)

msoShape4pointStar (91)

msoShapeActionButtonMovie (136)

msoShape5pointStar (92)

msoShapeActionButtonReturn (133)

msoShape8pointStar (93)

msoShapeActionButtonSound (135)

msoShapeActionButtonBackorPrevious (129)

msoShapeArc (25)

msoShapeActionButtonBeginning (131)

msoShapeBalloon (137)

msoShapeActionButtonCustom (125)

msoShapeBentArrow (41)

msoShapeActionButtonDocument (134)

Get Writing Word Macros, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.