creating text in Autocad 2000 using VBA

creating text in Autocad 2000 using VBA

Post by K » Fri, 12 May 2000 04:00:00

I want to insert some text into a drawing using VBA code, but I want to be able to change the *y font.......the help pages are crap...I just keep going round and round reading about changing textstyle changing textfont...but it doesnt show you the command to actually *y draw the changed text on the screen.....sorry go a bit carried away there...

any help would be appreciated

Ive got this far......

Private Sub CommandButton1_Click()
' Create a textstyle named "New_Textstyle" in current drawing
    Dim txtStyleObj As AcadTextStyle

    ' Add the textstyle to the textstyles collection
    Set txtStyleObj = ThisDrawing.TextStyles.Add("New_Textstyle")

    MsgBox txtStyleObj.Name & " has been added." & vbCrLf & _
           "Height: " & txtStyleObj.height & vbCrLf & _
           "Width: " & txtStyleObj.Width, , "Add Example"
Dim textObj As AcadText
    Dim textString As String
    Dim insertionPoint(0 To 2) As Double
    Dim height As Double

    ' Define the text object
    textString = "Hello, World."
    insertionPoint(0) = 2: insertionPoint(1) = 2: insertionPoint(2) = 0

    height = 0.5

    ' Create the text object in model space
    Set textObj = ThisDrawing.ModelSpace.AddText(textString, insertionPoint, height)

End Sub