Class Shape (Word VBA)

The class Shape represents an object in the drawing layer, such as an AutoShape, freeform, OLE object, ActiveX control, or picture. The Shape object is a member of the Shapes collection, which includes all the shapes in the main story of a document or in all the headers and footers of a document.

The classes Document, FreeformBuilder, Hyperlink, InlineShape and Window. give access to class Shape


Dim shp as Shape
Set shp = ActiveDocument.Background

For Each

Here is an example of processing the Shape items in a collection.


Dim shpCanvasItem As Shape
For Each shpCanvasItem In CanvasItems
	
Next shpCanvasItem

Methods

Apply - expression.Apply

CanvasCropBottom - Crops a percentage of the height of a drawing canvas from the bottom of the canvas.

CanvasCropLeft - Crops a percentage of the width of a drawing canvas from the left side of the canvas.

CanvasCropRight - Crops a percentage of the width of a drawing canvas from the right side of the canvas.

CanvasCropTop - Crops a percentage of the height of a drawing canvas from the top of the canvas.

ConvertToInlineShape - Converts the specified shape in the drawing layer of a document to an inline shape in the text layer. You can convert only shapes that represent pictures, OLE objects, or ActiveX controls. This method returns an InlineShape object that represents the picture or OLE object.

Delete - Deletes the specified shape node.

Duplicate - Creates a duplicate of the specified Shape object, adds the new shape to the Shapes collection at a standard offset from the original shapes, and then returns the new Shape object.

Flip - Flips a shape horizontally or vertically.

IncrementLeft - Moves the specified shape horizontally by the specified number of points.

IncrementRotation - Changes the rotation of the specified shape around the z-axis by the specified number of degrees.

IncrementTop - Moves the specified shape vertically by the specified number of points.

PickUp - Copies the formatting of the specified shape.

ScaleHeight - Scales the height of the shape by a specified factor.

ScaleWidth - Scales the width of the shape by a specified factor.

Select - Selects the specified shape.

SetShapesDefaultProperties - Applies the formatting of the default shape for a document to the specified shape.

Ungroup - Ungroups any grouped shapes in the specified shape.

ZOrder - Moves the specified shape in front of or behind other shapes in the collection (that is, changes the shape's position in the z-order).

Properties

Adjustments returns an Adjustments object that contains adjustment values for all the adjustments in the specified Shape object that represents an AutoShape or WordArt.

AlternativeText returns or sets the alternative text associated with a shape in a webpage.

Anchor returns a Range object that represents the anchoring range for the specified shape or shape range.

AutoShapeType returns or sets the shape type for the specified Shape object, which must represent an AutoShape other than a line or freeform drawing.

BackgroundStyle sets or returns the background style of the specified shape.

Callout returns a CalloutFormat object that contains callout formatting properties for the specified shape.

CanvasItems returns a CanvasShapes object that represents a collection of shapes in a drawing canvas.

Chart returns a Chart object that represents a chart within the collection of shapes in a document.

Child true if the shape is a child shape or if all shapes in a shape range are child shapes of the same parent.

Decorative sets or returns the decorative flag for the specified object.

Fill returns a FillFormat object that contains fill formatting properties for the specified shape.

Glow returns a GlowFormat object that represents the glow formatting for a shape.

GraphicStyle returns or sets an MsoGraphicStyleIndex constant that represents the style of an SVG graphic.

GroupItems returns a GroupShapes object that represents the individual shapes in the specified group.

HasChart true if the specified shape has a chart.

HasSmartArt returns True if there is a SmartArt diagram present on the shape.

Height returns or sets the height (in points) of the specified shape.

HeightRelative returns or sets a Single that represents the percentage of the relative height of a shape.

HorizontalFlip indicates that a shape has been flipped horizontally.

Hyperlink returns a Hyperlink object that represents the hyperlink associated with a Shape object.

ID returns the identification type for the specified shape.

LayoutInCell returns a Long that represents whether a shape in a table is displayed inside or outside the table.

Left returns or sets a Single that represents the horizontal position, measured in points, of the specified shape or shape range. Can also be any valid WdShapePosition constant.

LeftRelative returns or sets a Single that represents the relative left position of a shape.

Line returns a LineFormat object that contains line formatting properties for the specified shape.

LinkFormat returns a LinkFormat object that represents the link options of a shape that is linked to a file. Read/only.

LockAnchor true if the anchor of a Shape object is locked to the anchoring range.

LockAspectRatio msoTrue if the specified shape retains its original proportions when you resize it. MsoFalse if you can change the height and width of the shape independently of one another when you resize it.

Model3D returns a Model3DFormat object that contains Model3D properties.

Name returns or sets the name of the specified object.

Nodes returns a ShapeNodes collection that represents the geometric description of the specified shape.

OLEFormat returns an OLEFormat object that represents the OLE characteristics (other than linking) for the specified shape, inline shape, or field.

ParentGroup returns a Shape object that represents the common parent shape of a child shape or a range of child shapes.

PictureFormat returns a PictureFormat object that contains picture formatting properties for the specified object.

Reflection returns a ReflectionFormat object that represents the reflection formatting for a shape.

RelativeHorizontalPosition specifies to the relative horizontal position of a shape.

RelativeHorizontalSize returns or sets a WdRelativeVerticalSize constant that represents the object to which a range of shapes is relative.

RelativeVerticalPosition specifies the relative vertical position of a shape.

RelativeVerticalSize returns or sets a WdRelativeVerticalSize constant that represents the relative vertical size of a shape.

Rotation returns or sets the number of degrees the specified shape is rotated around the z-axis. A positive value indicates clockwise rotation; a negative value indicates counterclockwise rotation.

Script returns a Script object, which represents a block of script or code for an image on a webpage.

Shadow returns a ShadowFormat object that represents the shadow formatting for the specified shape.

ShapeStyle returns or sets the shape style for the specified shape.

SmartArt returns a SmartArt object that provides a way to work with the SmartArt associated with the specified shape.

SoftEdge returns a SoftEdgeFormat object that represents the soft edge formatting for a shape.

TextEffect returns a TextEffectFormat object that contains text-effect formatting properties for the specified shape.

TextFrame returns a TextFrame object that contains the text for the specified shape.

TextFrame2 returns a TextFrame2 object that contains the text for the specified shape.

ThreeD returns a ThreeDFormat object that contains 3D formatting properties for the specified shape.

Title returns or sets a String that contains a title for the specified shape.

Top returns or sets the vertical position of the specified shape or shape range in points.

TopRelative returns or sets a Single that represents the relative top position of a shape.

Type returns the type of inline shape.

VerticalFlip true if the specified shape is flipped around the vertical axis.

Vertices returns the coordinates of the specified freeform drawing's vertices (and control points for Bézier curves) as a series of coordinate pairs.

Visible true if the specified object, or the formatting applied to it, is visible.

Width returns or sets the width, in points, of the specified shape.

WidthRelative returns or sets a Single that represents the relative width of a shape.

WrapFormat returns a WrapFormat object that contains the properties for wrapping text around the specified shape.

ZOrderPosition returns a Long that represents the position of the specified shape in the z-order.

Adjustments - Contains a collection of adjustment values for the specified AutoShape or WordArt object. Each adjustment value represents one way an adjustment handle can be adjusted. Because some adjustment handles can be adjusted in two ways—for instance, some handles can be adjusted both horizontally and vertically—a shape can have more adjustment values than it has adjustment handles. A shape can have up to eight adjustments.

CalloutFormat - Contains properties and methods that apply to line callouts.

CanvasShapes - Use the CanvasItems property of either a Shape or ShapeRange object to return a CanvasShapes collection.

Chart - Represents a chart in a document.

FillFormat - Represents fill formatting for a shape. A shape can have a solid, gradient, texture, pattern, picture, or semi-transparent fill.

GlowFormat - Represents the glow formatting for a shape or range of shapes.

GroupShapes - Represents the individual shapes within a grouped shape. Each shape contained within a group of shapes is represented by a Shape object.

Hyperlink - Represents a hyperlink. The Hyperlink object is a member of the Hyperlinks collection.

InlineShape - Represents an object in the text layer of a document. An inline shape can only be a picture, an OLE object, or an ActiveX control. The InlineShape object is a member of the InlineShapes collection. The InlineShapes collection contains all the shapes that appear inline in a document, range, or selection.

LineFormat - Represents line and arrowhead formatting. For a line, the LineFormat object contains formatting information for the line itself; for a shape with a border, this object contains formatting information for the shape's border.

LinkFormat - Represents the linking characteristics for an OLE object or picture.

Model3DFormat - Represents the properties of a 3D model shape.

OLEFormat - Represents the OLE characteristics (other than linking) for an OLE object, ActiveX control, or field.

PictureFormat - Contains properties and methods that apply to pictures and OLE objects. The LinkFormat object contains properties and methods that apply to linked OLE objects only. The OLEFormat object contains properties and methods that apply to OLE objects whether or not they're linked.

Range - Represents a contiguous area in a document. Each Range object is defined by a starting and ending character position.

ReflectionFormat - Represents the reflection formatting for a shape or range of shapes.

ShadowFormat - Represents shadow formatting for a shape.

ShapeNodes - A collection of all the ShapeNode objects in the specified freeform. Each ShapeNode object represents either a node between segments in a freeform or a control point for a curved segment of a freeform.

ShapeRange - Represents a shape range, which is a set of shapes on a document. A shape range can contain as few as one shape or as many as all the shapes in the document.

SoftEdgeFormat - Represents the soft edge formatting for a shape or range of shapes.

TextEffectFormat - Contains properties and methods that apply to WordArt objects.

TextFrame - Represents the text frame in a Shape object. The TextFrame object contains the text in the text frame and the properties that control the margins and orientation of the text frame.

ThreeDFormat - Represents a shape's three-dimensional formatting.

WrapFormat - Represents all the properties for wrapping text around a shape or shape range.