第二弾は、Graphics MLで話題になった曲線の長さを求めるスクリプトです。
Attribute VB_Name = "CurveLength" Option Explicit Sub CurveLength() ' ' Recorded / Modified 01/07/24 ' ' Description: ' DRAW VBA Helpのサンプルを参考にmm単位で表示するように改造 ' Dim shp As Shape Dim du As cdrUnit ActiveDocument.Unit = cdrMillimeter Set shp = ActiveSelection.Shapes(1) If shp.Type = cdrCurveShape Then MSGBOX "The length of the curve is: " & vbCrLf & shp.Curve.Length & " mm" Else MSGBOX "選択オブジェクトは曲線ではありません" End If ActiveDocument.Unit = du End Sub