角丸マクロ

作成日時: 2021-01-13 13:28:43
公開終了: -

Sub 角丸()
Dim tmpText As String
Dim shapeRadius As Integer
Dim flag As Boolean
Dim roundedRectangle As Shape

flag = False

Do
tmpText = InputBox("角丸四角形の半径を入力してください")
If StrPtr(tmpText) = 0 Then
Exit Sub 'キャンセル時は終了
End If
shapeRadius = Val(tmpText) '数値に変換
If shapeRadius <= 0 Then
MsgBox "0以上の数値を設定してください"
Else
flag = True
End If
Loop Until flag = True

With ActiveWindow.Selection
If .Type = ppSelectionShapes Then
For Each roundedRectangle In .ShapeRange
With roundedRectangle

If .Width < .Height Then
.Adjustments(1) = shapeRadius / .Width
Else
.Adjustments(1) = shapeRadius / .Height
End If
End With
Next roundedRectangle
End If
End With
End Sub