精品文档---下载后可任意编辑目录精品文档---下载后可任意编辑第4章 Shape(图形)、Chart(图表)对象技巧1 在工作表中添加图形假如需要在工作表中添加图形对象,可以使用 AddShape 方法,如下面的代码所示
#001 Sub AddShape()#002 Dim myShape As Shape#003 On Error Resume Next#004 Sheet1
Shapes("myShape")
Delete#005 Set myShape = Sheet1
Shapes
AddShape(msoShapeRectangle, 40, 120, 280, 30)#006 With myShape#007
Name = "myShape"#008 #009
Text = "单击将选择 Sheet2
"#010 With
Font#011
Name = "华文行楷"#012
FontStyle = "常规"#013
Size = 22#014
ColorIndex = 7#015 End With#016 End With#017 With
TextFrame #018
HorizontalAlignment =-4108#019
VerticalAlignment = -4108#020 End With#021
Placement = 3#022 End With#023 #024 #025 With
Line#026
Weight = 1#027
DashStyle = msoLineSolid#028
Style = msoLineSingle#029
Transparency = 0#030
Visible = msoTrue#031
ForeColor
SchemeColor = 40#032
BackCo