Public Sub Example()
Dim currLayer As AcadLayer
Dim thisLayer As AcadLayer
Dim sLayerName As String
Dim titleBlock As AcadBlockReference
Dim sTitleBlock As String
Dim pt(0 To 2) As Double
Dim rScale As Double
'Define the layer you want
sLayerName = "power"
'Store the current layer setting
Set currLayer = ThisDrawing.ActiveLayer
'Find and Switch Layers
For Each thisLayer In ThisDrawing.Layers
If thisLayer.Name Like sLayerName Then
thisLayer.Freeze = False
thisLayer.LayerOn = True
ThisDrawing.ActiveLayer = thisLayer
Exit Sub
End If
Next
'Define the Block
sTitleBlock = "Plug.dwg"
'Insertion Point (5,10,0) and Scale (8)
pt(0) = 5
pt(1) = 10
rScale = 8
'Insert the Block
Set titleBlock = ThisDrawing.ModelSpace.InsertBlock _
(pt, sTitleBlock, rScale, rScale, 1#, 0#)
'Restore the Previous Layer
ThisDrawing.ActiveLayer = currLayer
End Sub