ShapeRange.AutoShapeType property (Publisher)

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

Syntax

expression.AutoShapeType

expression A variable that represents a ShapeRange 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 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 value.

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.

Sub ShapeShift() 
 
 Dim srShift As ShapeRange 
 
 Set srShift = Application.ActiveDocument.Selection.ShapeRange 
 If srShift.AutoShapeType = msoShapeHeart Then 
 srShift.AutoShapeType = msoShapeLightningBolt 
 Else 
 srShift.AutoShapeType = msoShape5pointStar 
 End If 
 
End Sub

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.