質問するログイン新規登録

回答編集履歴

2

▲対応版

2020/08/04 06:39

投稿

ttyp03
ttyp03

スコア17002

answer CHANGED
@@ -48,4 +48,58 @@
48
48
  ```
49
49
  実行結果を載せておきます。
50
50
  シートの枠線は非表示にしています。
51
- ![イメージ説明](3f5dd0dcfac8e1a6285f38e12bd3337f.png)
51
+ ![イメージ説明](3f5dd0dcfac8e1a6285f38e12bd3337f.png)
52
+
53
+ ---
54
+ ご要望のあった▲に対応したものを作ってみました。
55
+ ▲の書き方が適当(というか作りっぱなし)なのでたぶん正三角形にはなってないです。
56
+ なので相変わらずずれてますが、ご勘弁ください。
57
+ ```VBA
58
+ Sub test()
59
+ Dim x As Long
60
+ Dim y As Long
61
+ Dim l As Long
62
+
63
+ l = 60
64
+
65
+ x = 100
66
+ y = 100
67
+ Call threeline(x, y, l)
68
+ Call threeline(x, y, l)
69
+ Call threeline(x, y, l)
70
+
71
+ x = 81
72
+ y = 141
73
+ Call threeline(x, y, l)
74
+ Call threeline(x, y, l)
75
+ Call threeline(x, y, l)
76
+
77
+ x = 62
78
+ y = 182
79
+ Call threeline(x, y, l)
80
+ Call threeline(x, y, l)
81
+ Call threeline(x, y, l)
82
+
83
+ End Sub
84
+
85
+ Sub threeline(x As Long, y As Long, ByVal l As Long)
86
+
87
+ Dim sp As Shape
88
+ For i = 1 To 3 '---3回処理を繰り返す
89
+ Set sp = Shapes.AddLine(beginx:=x, BeginY:=y, EndX:=x, EndY:=y + l)
90
+ sp.Rotation = i * 60
91
+ Next i
92
+
93
+ With Shapes.AddShape(msoShapeIsoscelesTriangle, x + l / 2 - 11, y + l / 2 / 2 - 4, 7, 7)
94
+ .Rotation = 90
95
+ End With
96
+ With Shapes.AddShape(msoShapeIsoscelesTriangle, x - 7, y, 7, 7)
97
+ .Rotation = 270
98
+ End With
99
+
100
+ x = x + 45
101
+ y = y - 5
102
+
103
+ End Sub
104
+ ```
105
+ ![イメージ説明](6fcdfe716573c5e4da69b64246a6283f.png)

1

実行結果を添付

2020/08/04 06:39

投稿

ttyp03
ttyp03

スコア17002

answer CHANGED
@@ -45,6 +45,7 @@
45
45
  y = y - 5
46
46
 
47
47
  End Sub
48
-
49
-
50
- ```
48
+ ```
49
+ 実行結果を載せておきます。
50
+ シートの枠線は非表示にしています。
51
+ ![イメージ説明](3f5dd0dcfac8e1a6285f38e12bd3337f.png)