-
This macro takes any single line text that you select and converts it to Mtext then moves it up .03 and only works in Paper Space.
[VBA]Option Explicit
Sub ad_ConvertText()
Dim adEntity As AcadObject
Dim adNewMText As AcadMText
Dim adNewText As AcadText
Dim basePnt As Variant
Dim holdStr As String
Dim adselected As Boolean
Dim point1(0 To 2) As Double
Dim point2(0 To 2) As Double
On Error Resume Next
adselected = True
Do While adselected = True
Set adEntity = Nothing
ThisDrawing.Utility.GetEntity adEntity, basePnt, "Pick Text or MText Entity>> "
holdStr = adEntity.textString
If adEntity.ObjectName = "AcDbText" Then
Set adNewMText = ThisDrawing.PaperSpace.AddMText(adEntity.insertionPoint, Len(holdStr), holdStr)
adNewMText.AttachmentPoint = acAttachmentPointTopLeft
point1(0) = 0: point1(1) = 0: point1(2) = 0:
point2(0) = 0: point2(1) = 0.03: point2(2) = 0:
adNewMText.Move point1, point2
adNewMText.Update
adEntity.Delete
End If
If adEntity Is Nothing Then Exit Sub
Loop
End Sub
[/VBA]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules