Width Example

Using Programming Languages other than VBA

Sub Example_Width()
	' This example creates an MText object in model space.
	' It then changes the width of the MText object.

	Dim MTextObj As AcadMText
	Dim corner(0 To 2) As Double
	Dim width As Double
	Dim text As String
	corner(0) = 0: corner(1) = 5: corner(2) = 0
	width = 10
	text = "This is the text String for the mtext Object"

	' Creates the mtext Object
	Set MTextObj = ThisDrawing.ModelSpace.AddMText(corner, width, text)
	ZoomAll

	' Find the current width of the mtext object
	width = MTextObj.width
	MsgBox "The current width of the mtext object is " & MTextObj.width, , "Width Example"

	' Change the width of the mtext object
	MTextObj.width = width / 2
	MTextObj.Update
	MsgBox "The new width of the mtext object is " & MTextObj.width, , "Width Example"

End Sub

 

   Comments?