Excel / VBA:在vba / excel中更改圆角矩形的圆度

时间:2011-02-28 18:49:01

标签: excel vba excel-vba excel-2007

我试图弄清楚如何使用VBA在Excel中更改圆角矩形的圆度。

我开始创建圆角矩形,但此时我不知道下一步该做什么。

Set roundedRec = ws.Shapes.AddShape(msoShapeRoundedRectangle, 10, 10, 200, 40) 

我用Google搜索了vba shapes roundness roundedexcel vba rounded rectangle corner radius和其他类似的词组,但没有找到任何非常有益或有帮助的内容。我开始认为我无法通过visual basic更改此属性,但我可以通过Excel的GUI来完成。

2 个答案:

答案 0 :(得分:0)

我用Google搜索msoShapeRoundedRectangle radius,第一个link有一个例子:

With oSh
    oSh.AutoShapeType = msoShapeRoundedRectangle
    .Adjustments(1) = sngRounding
End With

答案 1 :(得分:0)

shape对象有一个Fill属性,它有方法

  

.OneColorGradient(Style,Variant,Degree)

     

.TwoColorGradient(Style,Variant)

使用考试

Set shp = ActiveSheet.Shapes("Rounded Rectangle 1")
shp.Adjustments(1) = shp.Adjustments(1) * 2

shp.Fill.ForeColor.RGB = RGB(0, 0, 128)

shp.Fill.OneColorGradient msoGradientHorizontal, 1, 1