AddMText method example

Sub AddMtextExample()
' This example creates Mtext and adds it to the drawing using the
' AddMtext method.
    Dim sBuf As String
    Dim oMtext As AcadMText
    Dim insPt(0 To 2) As Double
    insPt(0) = 0: insPt(1) = 9
    Dim dWidth As Double
    dWidth = 50
    sBuf = "Line one of test string for the AddMtext method"
    sBuf = sBuf & vbCrLf & "Line two of test string for the AddMtext method"
    sBuf = sBuf & vbCrLf & "Line three of test string for the AddMtext method"
    ' Add the mtext Object
    Set oMtext = ThisDrawing.ModelSpace.AddMText(insPt, dWidth, sBuf)
    oMtext.width = dWidth
    oMtext.Height = 1
    oMtext.Update
    ThisDrawing.Application.ZoomExtents
End Sub

© Bricsys NV. All rights reserved.