开发者

Excel/VBA: change roundness of a rounded rectangle in vba/excel

开发者 https://www.devze.com 2023-02-13 18:54 出处:网络
I am trying to figure out how to change the roundness of a rounded rectangle shape in Excel using VBA.

I am trying to figure out how to change the roundness of a rounded rectangle shape in Excel using VBA.

I started out by creating the rounded rectangle, but at this point I'm not sure what to do next.

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

I've googled for vba shapes roundness rounded,开发者_运维知识库 excel vba rounded rectangle corner radius and other similar phrases, but haven't found anything terribly instructive or helpful. I'm beginning to think I can't change this property via visual basic, though I can do it through Excel's GUI.


I googled msoShapeRoundedRectangle radius, and the first link had an example:

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


The shape object has a Fill property which has methods

.OneColorGradient(Style, Variant, Degree)

.TwoColorGradient(Style, Variant)

examle of use

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

精彩评论

暂无评论...
验证码 换一张
取 消