Color property example
Sub Color_Example()
Dim ent As AcadEntity
Dim NewColor As Integer
Dim Response As VbMsgBoxResult
MsgBox "Number of entities in ModelSpace = " & ActiveDocument.ModelSpace.Count
For Each ent In ThisDrawing.ModelSpace
Response = MsgBox("Found a " & ent.ObjectName & " with color: " & ent.Color & Chr(13) & "Do you want to change it?", vbYesNo, "Color of Entities")
If Response = vbYes Then
NewColor = InputBox("New color [0-256]: for " & ent.ObjectName)
ent.Color = NewColor
ent.Update
End If
Response = MsgBox("Continue listing entities?", vbYesNo, "Color of Entities")
If Response = vbNo Then Exit For
Next ent
End Sub
© Bricsys NV. All rights reserved. |