Shape.AutoShapeType Property

Publisher Developer Reference

Returns or sets an MsoAutoShapeType constant that specifies a Shape object's AutoShape type.

Syntax

expression.AutoShapeType

expression   A variable that represents a Shape object.

Remarks

The AutoShapeType property value can be one of the MsoAutoShapeType constants declared in the Microsoft Office type library.

AutoShapes correspond to Shape objects, although the AutoShapeType property for non-Publisher shapes will also return a value. WordArt, OLE, Web Form control, table and picture frame objects should return msoShapeMixed as their AutoShapeType property value. Text frames should return msoShapeRectangle as their AutoShapeType property.

Example

This example converts the selected AutoShape object to a lightning bolt if it is a heart and to a 5-point star if it is not. For this example to execute properly, you must have an AutoShape object selected in the active publication.

Visual Basic for Applications
  Sub ShapeShift()
Dim srShift As ShapeRange

Set srShift = Application.ActiveDocument.Selection.ShapeRange
If srShift.<strong>AutoShapeType</strong> = msoShapeHeart Then
    srShift.<strong>AutoShapeType</strong> = msoShapeLightningBolt
Else
    srShift.<strong>AutoShapeType</strong> = msoShape5pointStar
End If

End Sub

See Also