AddShape Method [Excel 2003 VBA Language Reference]
As it applies to the Shapes object, returns a Shape object that represents the new AutoShape in a worksheet. As it applies to the CanvasShapes object, returns a Shape object that represents the new AutoShape in a drawing canvas.
expression.AddShape(Type, Left, Top, Width, Height)
expression Required. An expression that returns a Shapes object.
MsoAutoShapeType
MsoAutoShapeType can be one of these MsoAutoShapeType constants. |
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 |
msoShapeFlowchartConnector |
msoShapeFlowchartData |
msoShapeFlowchartDecision |
msoShapeFlowchartDelay |
msoShapeFlowchartDirectAccessStorage |
msoShapeFlowchartDisplay |
msoShapeFlowchartDocument |
msoShapeFlowchartExtract |
msoShapeFlowchartInternalStorage |
msoShapeFlowchartMagneticDisk |
msoShapeFlowchartManualInput |
msoShapeFlowchartManualOperation |
msoShapeFlowchartMerge |
msoShapeFlowchartMultidocument |
msoShapeFlowchartOffpageConnector |
msoShapeFlowchartOr |
msoShapeFlowchartPredefinedProcess |
msoShapeFlowchartPreparation |
msoShapeFlowchartProcess |
msoShapeFlowchartPunchedTape |
msoShapeFlowchartSequentialAccessStorage |
msoShapeFlowchartSort |
msoShapeFlowchartStoredData |
msoShapeFlowchartSummingJunction |
msoShapeFlowchartTerminator |
msoShapeFoldedCorner |
msoShapeHeart |
msoShapeHexagon |
msoShapeHorizontalScroll |
msoShapeIsoscelesTriangle |
msoShapeLeftArrow |
msoShapeLeftArrowCallout |
msoShapeLeftBrace |
msoShapeLeftBracket |
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 |
Left, Top Required Single. The position (in points) of the upper-left corner of the AutoShape's bounding box relative to the upper-left corner of the document.
Width, Height Required Single. The width and height of the AutoShape's bounding box, in points.
Remarks
To change the type of an AutoShape that you've added, set the AutoShapeType property.
Example
This example adds a rectangle to myDocument
.
Set myDocument = Worksheets(1)
myDocument.Shapes.AddShape msoShapeRectangle, 50, 50, 100, 200
Applies to | Shapes Collection