Excel/VBA:如何在VBA/Excel中更改圆角矩形的圆角程度

3

我正在尝试使用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

形状对象具有填充属性,其中包含方法:

.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

0

我在谷歌上搜索了msoShapeRoundedRectangle radius,第一个链接给出了一个例子:

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

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接