Sub Ch4_FormatMText()
Dim mtextObj As AcadMText
Dim insertPoint(0 To 2) As Double
Dim width As Double
Dim textString As String
insertPoint(0) = 2
insertPoint(1) = 2
insertPoint(2) = 0
width = 4
' Define the ASCII characters for the control characters
Dim OB As Long ' Open Bracket {
Dim CB As Long ' Close Bracket }
Dim BS As Long ' Back Slash \
Dim FS As Long ' Forward Slash /
Dim SC As Long ' Semicolon ;
OB = Asc("{")
CB = Asc("}")
BS = Asc("\")
FS = Asc("/")
SC = Asc(";")
' Assign the text string the following line of control
' characters and text characters:
' {{\H1.5x; Big text}\A2; over text\A1;/\A0; under text}
textString = "Big text" + Chr(CB) + Chr(BS) + "A2" _
+ Chr(SC) + "over text" + Chr(BS) + "A1" + Chr(SC) _
+ Chr(FS) + Chr(BS) + "A0" + Chr(SC) + "under text" _
+ Chr(CB)
' Create a text Object in model space
Set mtextObj = ThisDrawing.ModelSpace.AddMText(insertPoint, width, textString)
ZoomAll
End Sub