Message 1 of 3
Acces to AcadMText object problem
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi.
I can't access the MText object. What am I doing wrong? I'm trying to get to an MText object to be able to change a text string in it, or move it, or erase it. I can't connect to the MText object, even though I know the Index ID. How to acces to MText Box ?
Sub CreateMText()
Dim mtextObj As AcadMText
Dim insertPoint(0 To 2) As Double
Dim targetPoint(0 To 2) As Double
Dim width As Double
Dim textString As String
Dim s1 As Double
Dim s2 As Double
insertPoint(0) = 2
insertPoint(1) = 2
insertPoint(2) = 0
width = 100
textString = "mTextBox 1"
' Create a text Object in model space
Set mtextObj = ThisDrawing.ModelSpace.AddMText(InsertionPoint:=insertPoint, width:=width, Text:=textString)
s1 = mtextObj.ObjectID
insertPoint(0) = 10
insertPoint(1) = 10
insertPoint(2) = 0
width = 100
textString = "mTextBox 2"
' Create a text Object in model space
Set mtextObj = ThisDrawing.ModelSpace.AddMText(InsertionPoint:=insertPoint, width:=width, Text:=textString)
s2 = mtextObj.ObjectID
mtextObj.textString = "I don't know..."
MsgBox "mTextBox 1 item number is: " & s1
MsgBox "mTextBox 2 item number is: " & s2
targetPoint(0) = 20
targetPoint(1) = 20
targetPoint(2) = 0
ThisDrawing.ModelSpace.Item(s1).Move insertPoint, targetPoint
ThisDrawing.ModelSpace.Item(s2).Delete
ZoomAll
End Sub
Hi.