You can't choose which instance of Autocad you want to connect to.
COM will connect to the first instance available.
The sample below is for 2009
{code}
Public acadApp As Autodesk.AutoCAD.Interop.AcadApplication
Public Sub getOdbx(ByRef acadApp As Autodesk.AutoCAD.Interop.AcadApplication, ByRef acadDBX As Object, ByVal FileName As String)
Try
acadDBX = acadApp.GetInterfaceObject("ObjectDBX.AxDbDocument.17")
Catch ex As Exception
Try
If Not acadApp Is Nothing Then
Try
acadApp = GetObject(, "AutoCAD.Application.17.2")
Catch ex3 As Exception
acadApp = Nothing
End Try
End If
acadDBX = acadApp.GetInterfaceObject("ObjectDBX.AxDbDocument.17")
Catch ex2 As Exception
MessageBox.Show("Error Connecting to AutoCAD", "Autocad Message", MessageBoxButtons.OK, MessageBoxIcon.Stop)
End Try
End Try
End Sub
{code}
---------------------------
(defun botsbuildbots() (botsbuildbots))