About Creating Line Text (VBA/ActiveX)

Each individual line of text is a distinct object when using line text.

To create a line text object, use the AddText method. This method requires three values as input: the text string, the insertion point, and the height of the text.

The text string is the actual text to be displayed. Unicode, control code, and special characters are accepted. The insertion point is a variant array containing three doubles representing the 3D WCS coordinate in the drawing to place the text. The height of the text is a positive number representing the height of the uppercase text. Height is measured in the current units.

To Create Line Text

This example creates a line of text in model space, at the coordinate (2, 2, 0).

Sub Ch4_CreateText()
  Dim textObj As AcadText
  Dim textString As String
  Dim insertionPoint(0 To 2) As Double
  Dim height As Double

  ' Create the text object
  textString = "Hello, World."
  insertionPoint(0) = 2
  insertionPoint(1) = 2
  insertionPoint(2) = 0
  height = 0.5
  Set textObj = ThisDrawing.ModelSpace.AddText(textString, insertionPoint, height)
  textObj.Update
End Sub