将 Powerpoint vba 脚本中所有选定对象的矩形转换为圆角
Convert rectangle into rounded corner for all selected object in Powerpoint vba script
我正在尝试 运行 Powerpoint 模块中的脚本将所有选定的矩形形状转换为圆形,下面是我在网上获得的脚本,但它只转换第一个选定的矩形
这是 2016 年的 powerpoint
Sub SetShapeRoundingRadius()
Dim oShape As Shape
Dim sngRadius As Single ' Radius size in points
Set oShape = ActiveWindow.Selection.ShapeRange(1)
sngRadius = 0.1
With oShape
oShape.AutoShapeType = msoShapeRoundedRectangle
.Adjustments(1) = sngRadius
End With
Set oShape = Nothing
End Sub
也许试试这个:
Sub SetSdasdhapeRoundingRadius()
Dim oShape As Shape
Dim sngRadius As Single ' Radius size in points
For Each shp In ActivePresentation.Slides(1).Shapes
shp.Select
If InStr(1, shp.Name, "Rectangle") > 0 Then
Set oShape = ActiveWindow.Selection.ShapeRange(1)
sngRadius = 0.1
With oShape
oShape.AutoShapeType = msoShapeRoundedRectangle
.Adjustments(1) = sngRadius
End With
Set oShape = Nothing
End If
Next
End Sub
- 如果可行,您可以扩展它以通过循环在所有幻灯片上执行相同的操作。
此代码段将转换所选对象。此版本应用循环来处理 Selection.ShapeRange
返回的所有项目。
Dim oShape As Shape
Dim sngRadius As Single ' Radius size in points
sngRadius = 0.1
For Each oShape In ActiveWindow.Selection.ShapeRange
With oShape
oShape.AutoShapeType = msoShapeRoundedRectangle
.Adjustments(1) = sngRadius
End With
Next
Set oShape = Nothing
我正在尝试 运行 Powerpoint 模块中的脚本将所有选定的矩形形状转换为圆形,下面是我在网上获得的脚本,但它只转换第一个选定的矩形
这是 2016 年的 powerpoint
Sub SetShapeRoundingRadius()
Dim oShape As Shape
Dim sngRadius As Single ' Radius size in points
Set oShape = ActiveWindow.Selection.ShapeRange(1)
sngRadius = 0.1
With oShape
oShape.AutoShapeType = msoShapeRoundedRectangle
.Adjustments(1) = sngRadius
End With
Set oShape = Nothing
End Sub
也许试试这个:
Sub SetSdasdhapeRoundingRadius()
Dim oShape As Shape
Dim sngRadius As Single ' Radius size in points
For Each shp In ActivePresentation.Slides(1).Shapes
shp.Select
If InStr(1, shp.Name, "Rectangle") > 0 Then
Set oShape = ActiveWindow.Selection.ShapeRange(1)
sngRadius = 0.1
With oShape
oShape.AutoShapeType = msoShapeRoundedRectangle
.Adjustments(1) = sngRadius
End With
Set oShape = Nothing
End If
Next
End Sub
- 如果可行,您可以扩展它以通过循环在所有幻灯片上执行相同的操作。
此代码段将转换所选对象。此版本应用循环来处理 Selection.ShapeRange
返回的所有项目。
Dim oShape As Shape
Dim sngRadius As Single ' Radius size in points
sngRadius = 0.1
For Each oShape In ActiveWindow.Selection.ShapeRange
With oShape
oShape.AutoShapeType = msoShapeRoundedRectangle
.Adjustments(1) = sngRadius
End With
Next
Set oShape = Nothing