|
関数内のコードはもっと簡単でした
>新規ブックの標準モジュールに
>'==============================================================
>Sub test()
> Dim rad As Double
> rad = WorksheetFunction.pi() / 4
> Call mk_hutougou([b5].Left, [b5].Top, 20, rad, , False)
> Call mk_hutougou([b5].Left, [b5].Top, 20, rad, , True)
>End Sub
>'=====================================================================
Function mk_hutougou(ByVal stx As Double, ByVal sty As Double, ByVal rs As Double, ByVal rad As Double, Optional ByVal sht As Worksheet = Nothing, Optional ByVal opn As Boolean = False) As Shape
'不等号を作成する
' input stx 不等号始点となるLeft
' sty 不等号始点となるtop
' rs 半径距離
' rad 角度 Radian 0〜π
' sht 作成するシート
' opn false 右開き true 左開き
Dim pi As Double
Dim l1 As Line
Dim l2 As Line
pi = WorksheetFunction.pi()
If opn = True Then rad = 2 * pi - rad
If sht Is Nothing Then Set sht = ActiveSheet
Set l1 = sht.Lines.Add(stx, sty, stx + rs * Cos(rad / 2), sty + rs * Sin(-rad / 2))
Set l2 = sht.Lines.Add(stx, sty, stx + rs * Cos(rad / 2), sty + rs * Sin(rad / 2))
Set mk_hutougou = sht.Shapes.Range(Array(l1.Name, l2.Name)).Group
(l1.Name, l2.Name)).Group
>End Function
|
|