
创建自定义形状的 VBA 源码
Sub DrawTShapeSimple()
    
    Dim crv As Curve
    Dim sp As SubPath
    Dim st As Shape 
    Dim redColor As Color 
    
    ActiveDocument.Unit = cdrMillimeter
    
    Set crv = Application.CreateCurve(ActiveDocument)
    
    Set sp = crv.CreateSubPath(20, 40)
    
    sp.AppendLineSegment 20, 0
    sp.AppendLineSegment 0, 4
    sp.AppendLineSegment 0, 36
    
    sp.Closed = True
    
    Set st = ActiveLayer.CreateCurve(crv)
    
    Set redColor = Application.CreateCMYKColor(0, 100, 100, 0)
    
    
    st.Fill.UniformColor = redColor
    
End Sub