VBA中的一个疑问

来源:百度知道 编辑:UC知道 时间:2024/05/03 08:18:57
With ws
For Each myShape In .Shapes '删除工作表中所有的Shape对象
myShape.Delete
Next
Set myShape = .Shapes.AddShape(Type:=msoShape8pointStar, _
Left:=120, Top:=80, Width:=80, Height:=80)
End With

最近刚学习vba ,对语法还不太熟悉,有些疑问
(1)、想问下上段代码中 := 这个符号什么意思
(2)、AddShape函数的第一个参数可以直接使用msoShape8pointStar?

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
msoShapeBent