AddShape Method

Microsoft Word Visual Basic

Adds an AutoShape to a drawing canvas. Returns a Shape object that represents the AutoShape and adds it to the CanvasShapes collection.

expression.AddShape(Type, Left, Top, Width, Height)

expression    Required. An expression that returns a CanvasShapes object.

Type   Required Long. The type of shape to be returned. Can be any MsoAutoShapeType constant.

MsoAutoShapeType can be one of these MsoAutoShapeType constants.
msoShapeFlowchartDirectAccessStorage
msoShapeFlowchartDocument
msoShapeFlowchartInternalStorage
msoShapeFlowchartManualInput
msoShapeFlowchartMerge
msoShapeFlowchartOffpageConnector
msoShapeFlowchartPredefinedProcess
msoShapeFlowchartProcess
msoShapeLeftBracket
msoShapeFlowchartConnector
msoShapeFlowchartData
msoShapeFlowchartDecision
msoShapeFlowchartDelay
msoShapeFlowchartDisplay
msoShapeFlowchartExtract
msoShapeFlowchartMagneticDisk
msoShapeFlowchartManualOperation
msoShapeFlowchartMultidocument
msoShapeFlowchartOr
msoShapeFlowchartPreparation
msoShapeFlowchartPunchedTape
msoShapeFlowchartSequentialAccessStorage
msoShapeFlowchartSort
msoShapeFlowchartStoredData
msoShapeFlowchartSummingJunction
msoShapeFlowchartTerminator
msoShapeFoldedCorner
msoShapeHeart
msoShapeHexagon
msoShapeHorizontalScroll
msoShapeIsoscelesTriangle
msoShapeLeftArrow
msoShapeLeftArrowCallout
msoShapeLeftBrace
msoShapeLeftRightArrow
msoShapeLeftRightArrowCallout
msoShapeLeftRightUpArrow
msoShapeLeftUpArrow
msoShapeLightningBolt
msoShapeLineCallout1
msoShapeLineCallout1AccentBar
msoShapeLineCallout1BorderandAccentBar
msoShapeLineCallout1NoBorder
msoShapeLineCallout2
msoShapeLineCallout2AccentBar
msoShapeLineCallout2BorderandAccentBar
msoShapeLineCallout2NoBorder
msoShapeLineCallout3
msoShapeLineCallout3AccentBar
msoShapeLineCallout3BorderandAccentBar
msoShapeLineCallout3NoBorder
msoShapeLineCallout4
msoShapeLineCallout4AccentBar
msoShapeLineCallout4BorderandAccentBar
msoShapeLineCallout4NoBorder
msoShapeMixed
msoShapeMoon
msoShapeNoSymbol
msoShapeNotchedRightArrow
msoShapeNotPrimitive
msoShapeOctagon
msoShapeOval
msoShapeOvalCallout
msoShapeParallelogram
msoShapePentagon
msoShapePlaque
msoShapeQuadArrow
msoShapeQuadArrowCallout
msoShapeRectangle
msoShapeRectangularCallout
msoShapeRegularPentagon
msoShapeRightArrow
msoShapeRightArrowCallout
msoShapeRightBrace
msoShapeRightBracket
msoShapeRightTriangle
msoShapeRoundedRectangle
msoShapeRoundedRectangularCallout
msoShapeSmileyFace
msoShapeStripedRightArrow
msoShapeSun
msoShapeTrapezoid
msoShapeUpArrow
msoShapeUpArrowCallout
msoShapeUpDownArrow
msoShapeUpDownArrowCallout
msoShapeUpRibbon
msoShapeUTurnArrow
msoShapeVerticalScroll
msoShapeWave
msoShape16pointStar
msoShape24pointStar
msoShape32pointStar
msoShape4pointStar
msoShape5pointStar
msoShape8pointStar
msoShapeActionButtonBackorPrevious
msoShapeActionButtonBeginning
msoShapeActionButtonCustom
msoShapeActionButtonDocument
msoShapeActionButtonEnd
msoShapeActionButtonForwardorNext
msoShapeActionButtonHelp
msoShapeActionButtonHome
msoShapeActionButtonInformation
msoShapeActionButtonMovie
msoShapeActionButtonReturn
msoShapeActionButtonSound
msoShapeArc
msoShapeBalloon
msoShapeBentArrow
msoShapeBentUpArrow
msoShapeBevel
msoShapeBlockArc
msoShapeCan
msoShapeChevron
msoShapeCircularArrow
msoShapeCloudCallout
msoShapeCross
msoShapeCube
msoShapeCurvedDownArrow
msoShapeCurvedDownRibbon
msoShapeCurvedLeftArrow
msoShapeCurvedRightArrow
msoShapeCurvedUpArrow
msoShapeCurvedUpRibbon
msoShapeDiamond
msoShapeDonut
msoShapeDoubleBrace
msoShapeDoubleBracket
msoShapeDoubleWave
msoShapeDownArrow
msoShapeDownArrowCallout
msoShapeDownRibbon
msoShapeExplosion1
msoShapeExplosion2
msoShapeFlowchartAlternateProcess
msoShapeFlowchartCard
msoShapeFlowchartCollate

Left   Required Single. The position, measured in points, of the left edge of the AutoShape.

Top   Required Single. The position, measured in points, of the top edge of the AutoShape.

Width   Required Single. The width, measured in points, of the AutoShape.

Height   Required Single. The height, measured in points, of the AutoShape.

ShowAddShape method as it applies to the Shapes object.

Adds an AutoShape to a document. Returns a Shape object that represents the AutoShape and adds it to the Shapes collection.

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

expression    Required. An expression that returns a Shapes object.

Type   Required Long. The type of shape to be returned. Can be any MsoAutoShapeType constant.

MsoAutoShapeType can be one of these MsoAutoShapeType constants.
msoShapeFlowchartDirectAccessStorage
msoShapeFlowchartDocument
msoShapeFlowchartInternalStorage
msoShapeFlowchartManualInput
msoShapeFlowchartMerge
msoShapeFlowchartOffpageConnector
msoShapeFlowchartPredefinedProcess
msoShapeFlowchartProcess
msoShapeLeftBracket
msoShapeFlowchartConnector
msoShapeFlowchartData
msoShapeFlowchartDecision
msoShapeFlowchartDelay
msoShapeFlowchartDisplay
msoShapeFlowchartExtract
msoShapeFlowchartMagneticDisk
msoShapeFlowchartManualOperation
msoShapeFlowchartMultidocument
msoShapeFlowchartOr
msoShapeFlowchartPreparation
msoShapeFlowchartPunchedTape
msoShapeFlowchartSequentialAccessStorage
msoShapeFlowchartSort
msoShapeFlowchartStoredData
msoShapeFlowchartSummingJunction
msoShapeFlowchartTerminator
msoShapeFoldedCorner
msoShapeHeart
msoShapeHexagon
msoShapeHorizontalScroll
msoShapeIsoscelesTriangle
msoShapeLeftArrow
msoShapeLeftArrowCallout
msoShapeLeftBrace
msoShapeLeftRightArrow
msoShapeLeftRightArrowCallout
msoShapeLeftRightUpArrow
msoShapeLeftUpArrow
msoShapeLightningBolt
msoShapeLineCallout1
msoShapeLineCallout1AccentBar
msoShapeLineCallout1BorderandAccentBar
msoShapeLineCallout1NoBorder
msoShapeLineCallout2
msoShapeLineCallout2AccentBar
msoShapeLineCallout2BorderandAccentBar
msoShapeLineCallout2NoBorder
msoShapeLineCallout3
msoShapeLineCallout3AccentBar
msoShapeLineCallout3BorderandAccentBar
msoShapeLineCallout3NoBorder
msoShapeLineCallout4
msoShapeLineCallout4AccentBar
msoShapeLineCallout4BorderandAccentBar
msoShapeLineCallout4NoBorder
msoShapeMixed
msoShapeMoon
msoShapeNoSymbol
msoShapeNotchedRightArrow
msoShapeNotPrimitive
msoShapeOctagon
msoShapeOval
msoShapeOvalCallout
msoShapeParallelogram
msoShapePentagon
msoShapePlaque
msoShapeQuadArrow
msoShapeQuadArrowCallout
msoShapeRectangle
msoShapeRectangularCallout
msoShapeRegularPentagon
msoShapeRightArrow
msoShapeRightArrowCallout
msoShapeRightBrace
msoShapeRightBracket
msoShapeRightTriangle
msoShapeRoundedRectangle
msoShapeRoundedRectangularCallout
msoShapeSmileyFace
msoShapeStripedRightArrow
msoShapeSun
msoShapeTrapezoid
msoShapeUpArrow
msoShapeUpArrowCallout
msoShapeUpDownArrow
msoShapeUpDownArrowCallout
msoShapeUpRibbon
msoShapeUTurnArrow
msoShapeVerticalScroll
msoShapeWave
msoShape16pointStar
msoShape24pointStar
msoShape32pointStar
msoShape4pointStar
msoShape5pointStar
msoShape8pointStar
msoShapeActionButtonBackorPrevious
msoShapeActionButtonBeginning
msoShapeActionButtonCustom
msoShapeActionButtonDocument
msoShapeActionButtonEnd
msoShapeActionButtonForwardorNext
msoShapeActionButtonHelp
msoShapeActionButtonHome
msoShapeActionButtonInformation
msoShapeActionButtonMovie
msoShapeActionButtonReturn
msoShapeActionButtonSound
msoShapeArc
msoShapeBalloon
msoShapeBentArrow
msoShapeBentUpArrow
msoShapeBevel
msoShapeBlockArc
msoShapeCan
msoShapeChevron
msoShapeCircularArrow
msoShapeCloudCallout
msoShapeCross
msoShapeCube
msoShapeCurvedDownArrow
msoShapeCurvedDownRibbon
msoShapeCurvedLeftArrow
msoShapeCurvedRightArrow
msoShapeCurvedUpArrow
msoShapeCurvedUpRibbon
msoShapeDiamond
msoShapeDonut
msoShapeDoubleBrace
msoShapeDoubleBracket
msoShapeDoubleWave
msoShapeDownArrow
msoShapeDownArrowCallout
msoShapeDownRibbon
msoShapeExplosion1
msoShapeExplosion2
msoShapeFlowchartAlternateProcess
msoShapeFlowchartCard
msoShapeFlowchartCollate

Left   Required Single. The position, measured in points, of the left edge of the AutoShape.

Top   Required Single. The position, measured in points, of the top edge of the AutoShape.

Width   Required Single. The width, measured in points, of the AutoShape.

Height   Required Single. The height, measured in points, of the AutoShape.

Anchor   Optional Variant. A Range object that represents the text to which the AutoShape is bound. If Anchor is specified, the anchor is positioned at the beginning of the first paragraph in the anchoring range. If this argument is omitted, the anchoring range is selected automatically and the AutoShape is positioned relative to the top and left edges of the page.

Remarks

To change the type of an AutoShape that you've added, set the AutoShapeType property.

Example

ShowAs it applies to the CanvasShapes object.

This example creates a new canvas in the active document and adds a circle to the canvas.

Sub NewCanvasShape()
    Dim shpCanvas As Shape
    Dim shpCanvasShape As Shape

    'Add a new drawing canvas to the active document
    Set shpCanvas = ActiveDocument.Shapes.AddCanvas( _
        Left:=100, Top:=75, Width:=150, Height:=200)

    'Add a circle to the drawing canvas
    Set shpCanvasShape = shpCanvas.CanvasItems.AddShape( _
        Type:=msoShapeOval, Left:=25, Top:=25, _
        Width:=150, Height:=150)
End Sub
				

ShowAs it applies to the Shapes object.

This example adds a red rectangle to a new document.

Sub NewShape()
    Dim docNew As Document

    'Create a new document and adds a shape
    Set docNew = Documents.Add
    docNew.Shapes.AddShape Type:=msoShapeRectangle, _
        Left:=50, Top:=50, Width:=100, Height:=200

    'Format the shape
    docNew.Shapes(1).Fill.ForeColor _
        .RGB = RGB(Red:=200, Green:=15, Blue:=95)
End Sub