Name Example

Using Programming Languages other than VBA

Sub Example_Name()
	' This example creates a new layer. It then
	' changes the name of that layer.

	' Add the new layer
	Dim layerObj As AcadLayer
	Set layerObj = ThisDrawing.Layers.Add("NewLayer")

	' Find the name of the new layer
	Dim layerName As String
	layerName =
	MsgBox "A new layer was created with the name: " &, , "Name Example"

	' Change the name of the layer to "TEST". Note that behavior of the
	' following code will be different for different objects. In some cases such as
	' Block reference, changing the name means referencing to a new Block and therefore
	' a Block with named "TEST" should already exist: otherwise an error will be
	' returned. = "TEST"
	layerName =
	MsgBox "The new name of the layer is: " &, , "Name Example"

End Sub