VBA中的一个疑问

1)赋值

2)

当该方法应用于 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 属性。

示例

本示例向 myDocument 添加矩形。

Set myDocument = Worksheets(1)

myDocument.Shapes.AddShape msoShapeRectangle, 50, 50, 100, 200