About Reloading Xrefs (VBA/ActiveX)

If an externally referenced drawing os modified while you are working on the host drawing to which that xref is attached, you can update that xref drawing using the Reload method.

When you reload, the selected xref drawing is updated in your host drawing. Also, if you have unloaded an xref, you can choose to reload that externally referenced drawing at any time.

Reload an xref definition

This example attaches an external reference and then reloads the external reference. This example uses the 3D House.dwg file found in the sample directory. If you do not have this image, or if it is located in a different directory, insert a valid path and file name for the PathName variable.

Sub Ch10_ReloadingExternalReference()
 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:/Program Files/Autodesk/AutoCAD release/3D House.dwg"
 
 ' Add the external reference to the block
 Set xrefInserted = ThisDrawing.ModelSpace. _
 AttachExternalReference(PathName, "XREF_IMAGE", _
 insertionPnt, 1, 1, 1, 0, False)
 ZoomAll
 MsgBox "The external reference is attached."
 
 ' Reload the external reference definition
 ThisDrawing.Blocks.Item(xrefInserted.name).Reload
 MsgBox "The external reference is reloaded."
 Exit Sub
ERRORHANDLER:
 MsgBox Err.Description
End Sub