I been trying to figure out how to import an xref view into my dwg in VBA Autocad-ME. I have found code online that use .AttachExternalReference. But this only attaches the whole drawing and not an specific component. I do even know if this is possible in Autocad ME. But it should be something simple enough that there most be a way to do. If any of you know, I would appreciate the help.
I attached the example I started with, but it is not quite doing what I am looking for.
Sub Example_AttachExternalReference()
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' This example displays all the blocks in the current drawing
' before and after adding an external reference.
'
' This example uses the "city map.dwg" found in the Sample
' directory. If you do not have this drawing, or if it is
' in a different directory, insert a valid path and file name
' for the PathName variable below.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim ThisDrawing As AcadDocument
Dim InsertPoint(0 To 2) As Double
'Dim insertedBlock As AcadExternalReference
Dim insertedBlock As Object
Dim tempBlock As acadBlock
Dim msg As String, PathName As String
Dim InsertionPoint(0 To 2) As Double
Dim blockname As String
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Set ThisDrawing = AcadApplication.ActiveDocument
' Define external reference to be inserted
InsertPoint(0) = 1: InsertPoint(1) = 1: InsertPoint(2) = 0
PathName = "C:\Users\jomartinez\Desktop\happyFace.dwg"
blockname = "nameOfBlock"
' Display current Block information for this drawing
'GoSub ListBlocks
' Add the external reference to the drawing
Set insertedBlock = ThisDrawing.ModelSpace.AttachExternalReference(PathName, "XREF_IMAGE", InsertPoint, 1, 1, 1, 0, False)
'Set tempBlock = ThisDrawing.ModelSpace.InsertBlock(InsertionPoint, blockname, _
1, 1, 1, 0 * 0.0174532925)
ThisDrawing.Application.ZoomAll
End Sub