Unload Example

Using Programming Languages other than VBA

Sub Example_Unload()
	On Error GoTo ERRORHANDLER
					
	' Define external reference to be inserted
	Dim xrefHome As AcadBlock
	Dim xrefInserted As AcadExternalReference
	Dim insertionPnt(0 To 2) As Double
	Dim PathName As String
	insertionPnt(0) = 1
	insertionPnt(1) = 1
	insertionPnt(2) = 0
	PathName = "c:/AutoCAD/sample/City map.dwg"

	' Add the external reference
	Set xrefInserted = ThisDrawing.ModelSpace. _
			AttachExternalReference(PathName, "XREF_IMAGE", _
			insertionPnt, 1, 1, 1, 0, False)
	ZoomAll
	MsgBox "The external reference is attached."

	' Unload the external reference definition
	ThisDrawing.Blocks.Item(xrefInserted.name).Unload
	MsgBox "The external reference is unloaded."
	Exit Sub
ERRORHANDLER:
	MsgBox Err.Description
End Sub





   Comments?