jremy68
Materials
- Aug 12, 2004
- 4
I am looking for a vba program that will add numbers to all of the items in a selection set. The only problem is when I do this with a simple program I have to pick the items one by one in order to get the numbering in order is there anyway way to get the numbers to be in numeric order.
Sub numdemo()
Dim objSset As AcadSelectionSet
Dim objEnt As Object
Dim count As Integer
Dim textObj As AcadText
Dim textString As String
Dim height As Double
Dim minExt As Variant
Dim maxExt As Variant
Set objSset = ThisDrawing.SelectionSets.Add("ss")
objSset.SelectOnScreen
count = 0
For Each objEnt In objSset
objEnt.GetBoundingBox minExt, maxExt
minExt(0) = minExt(0) + 5
minExt(1) = minExt(1) + 5
count = count + 1
minExt(0) = minExt(0) + 5
minExt(1) = minExt(1) + 5
textString = count
height = 6
Set textObj = ThisDrawing.ModelSpace.AddText(textString, minExt, height)
Next 'objEnt
objSset.Delete
End Sub
Sub numdemo()
Dim objSset As AcadSelectionSet
Dim objEnt As Object
Dim count As Integer
Dim textObj As AcadText
Dim textString As String
Dim height As Double
Dim minExt As Variant
Dim maxExt As Variant
Set objSset = ThisDrawing.SelectionSets.Add("ss")
objSset.SelectOnScreen
count = 0
For Each objEnt In objSset
objEnt.GetBoundingBox minExt, maxExt
minExt(0) = minExt(0) + 5
minExt(1) = minExt(1) + 5
count = count + 1
minExt(0) = minExt(0) + 5
minExt(1) = minExt(1) + 5
textString = count
height = 6
Set textObj = ThisDrawing.ModelSpace.AddText(textString, minExt, height)
Next 'objEnt
objSset.Delete
End Sub