Detach method example

Private Sub Detach_Example()

' This example adds and detaches an external reference using the MAP.DWG ' file found in the Samples folder. You may need to change the path and

' filename for your system.

     Dim insPt As IntelliCAD.Point

     Dim insertedXRef As IntelliCAD.ExternalReference

     Dim msg As String, PathName As String, XrefName As String

     XrefName = InputBox("Type an XRef name")

     Set insPt = Library.CreatePoint(1, 1, 0)

     PathName = "c:\program files\IntelliCAD2001\Samples\map.dwg"

     ' Add the external reference to the drawing

     Set insertedXRef = ThisDocument.ModelSpace.AttachExternalReference(PathName, XrefName, insPt, 1, 1, 1, 0, False)

     MsgBox "The external reference '" & insertedXRef.name & "' is attached."

     

     ' Detach the external reference definition

     Dim name As String

     name = insertedXRef.name

 

     ThisDocument.Blocks.Item(name).Detach

     MsgBox "The external reference '" & XrefName & "' is detached."

End Sub