Excel VBA教程:AddShape方法

当该方法应用于 Shapes对象时,返回一个Shape对象,该对象代表工作表中的新自选图形。当该方法应用于 CanvasShapes对象时,返回一个 Shape对象,该对象代表绘图画布中的新自选图形。

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

expression   必选。该表达式返回 Shapes对象。

Type  MsoAutoShapeType 类型,必需。指定要创建的自选图形的类型。

MsoAutoShapeType 可为以下 MsoAutoShapeType 常量之一。
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   Single 类型,必需。相对于文档的左上角,以磅为单位给出自选图形边框左上角的位置。

Width, Height   Single 类型,必需。以磅为单位给出自选图形边框的宽度和高度。

说明

若要更改已添加的自选图形的类型,请设置AutoShapeType属性。

Excel VBA教程:AddShape方法·示例

本示例向myDocument 添加矩形。


Set myDocument = Worksheets(1)
myDocument.Shapes.AddShape msoShapeRectangle, 50, 50, 100, 200

上页:Excel VBA教程:AddSet方法 下页:Excel VBA教程:AddTextbox方法

Excel VBA教程:AddShape方法

Excel VBA教程:AddTextbox方法 Excel VBA教程:AddTextEffect方法
Excel VBA教程:AddToFavorites方法 Excel VBA教程:AdvancedFilter方法
Excel VBA教程:Align方法 Excel VBA教程:Apply方法
Excel VBA教程:ApplyCustomType方法 Excel VBA教程:ApplyDataLabels方法
Excel VBA教程:ApplyNames方法 Excel VBA教程:ApplyOutlineStyles方法
Excel VBA教程:AreaGroups方法 Excel VBA教程:Arrange方法
Excel VBA教程:AutoComplete方法 Excel VBA教程:AutoFill方法
Excel VBA教程:AutoFilter方法 Excel VBA教程:AutoFit方法
Excel VBA教程:AutoFormat方法 Excel VBA教程:AutomaticLength方法
Excel VBA教程:AutoOutline方法 Excel VBA教程:AutoShow方法
版权所有 © 中山市飞娥软件工作室 证书:粤ICP备09170368号