Author Topic: Late binding AxDbDocument  (Read 2626 times)

0 Members and 1 Guest are viewing this topic.

Bryco

  • Water Moccasin
  • Posts: 1864
Late binding AxDbDocument
« on: February 13, 2007, 11:23:56 PM »

I've finally had a little time to play with 2007 and once again there is reference problems.
The function below seems to work ok but I presume I'm going to get a perfermance hit.
Although I've written functions to set the correct reference before, I've never made a reliable one.
Does anyone have an early binding solution that works for 2006 and 2007?

Code: [Select]
Function SetAxdb() As Object

    'Dim dbxDoc As New AxDbDocument
    Dim dbxDoc As Object
    Select Case AcadVer
        Case 2000
            Set dbxDoc = GetInterfaceObject("ObjectDBX.AxDbDocument")
        Case 2002, 2004, 2005, 2006
            Set dbxDoc = GetInterfaceObject("ObjectDBX.AxDbDocument.16")
        Case 2007
            Set dbxDoc = GetInterfaceObject("ObjectDBX.AxDbDocument.17")
    End Select
   
    Set SetAxdb = dbxDoc

End Function

Fatty

  • Guest
Re: Late binding AxDbDocument
« Reply #1 on: February 14, 2007, 05:09:24 AM »
Hello, Bryco  :-)

I do not use late binding
here is a trick I use
Define ObjectDBX twice

Code: [Select]
     Dim oDBX As AxDbDocument
     Set oDBX = New AxDbDocument
     Set oDBX = Application.GetInterfaceObject("ObjectDBX.AxDbDocument.16")     '<--17 for A2006 and higher

I have A2005 only on my machine though
Hope that helps

~'J'~