O'Reilly logo

Writing Word Macros, Second Edition by Steven Roman PhD

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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)

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required