Delete Method |
Deletes a specified object or a set of saved layer settings.
Signature
object.Delete
Object
All
Drawing Objects, Block,
Dictionary, DimStyle, Group, Hyperlink, Layer, LayerStateManager, Layout, Linetype, PlotConfiguration,
PopupMenuItem,
PViewport, RegisteredApplication,
SelectionSet, TextStyle, Toolbar, ToolbarItem, UCS, View, Viewport, XRecord
The object or objects this method applies to.
Remarks
When you delete an object in a collection, all remaining items in the collection are reassigned a new index based on the current count. You should therefore avoid loops that delete an object while iterating through the collection. For example, the following VBA code will result in a runtime error:
For i = 0 To ThisDrawing.Groups.Count - 1 ThisDrawing.Groups.Item(i).Delete Next I
Instead, use the following VBA code to delete all members in a collection:
for each obj in ThisDrawing.Groups obj.Delete next obj
You can also use the following VBA code to delete a single member of a collection:
ThisDrawing.Groups.item("group1").Delete
An error will result if you attempt to delete a collection object.
ToolbarItem: You can only add or remove toolbar items when the toolbar is visible.
AcadLayerStateManager: This object takes an argument, Name, which is a string representing the layer state to be deleted.
Comments? |