Bind Example

Using Programming Languages other than VBA

Sub Example_Bind()
	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."

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





   Comments?