![見出し画像](https://assets.st-note.com/production/uploads/images/19534422/rectangle_large_type_2_d8324f46b0849b4196074a2c85c0eabe.jpeg?width=1200)
Photo by
hism
図形の頂点をVBAで操作する
こないだはじめて頂点をVBAで動かしたい場面に遭遇したので誰かの役に立てば。
Dim shp As Shape
Dim TarNum As Long '頂点のインデックス'
Dim NewX As Single
Dim NewY As Single
With shp.Nodes
Debug.Print Item(TarNum).Points(1,1) 'X座標'
Debug.Print Item(TarNum).Points(1,2) 'Y座標'
Call .SetPosition(TarNum, NewX, NewY)
End With
こんな感じで動く。Points()は取得のみのプロパティなので動かすときは.SetPositionメソッドを使うことに注意。
そういえばKindle Unlimitedにこんな本が載っていたので読み終わったらレビュー記事でもしたためよう。
いいなと思ったら応援しよう!
![タナイ](https://assets.st-note.com/production/uploads/images/172553734/profile_b88f06107b7ac8d99fd1082432949e71.jpg?width=600&crop=1:1,smart)