having problem with getinterfaceobject

Discussion in 'AutoCAD' started by Kelie, Sep 24, 2004.

  1. Kelie

    Kelie Guest

    The following function always fails at the last line.
    GetobjProj = objProj

    The error msg says:

    object variable or with block variable not set.

    Can someone help? Thanks a lot.


    Public Function GetobjProj(ProjID As String) As Object
    Dim ProjID2 As String
    ProjID2 = ProjID & "." & Left(ThisDrawing.GetVariable("ACADVER"), 2)
    Dim objProj As Object
    With ThisDrawing.Application
    Set objProj = .GetInterfaceObject(ProjID2)
    If objProj Is Nothing Then
    Set objProj = .GetInterfaceObject(ProjID)
    End If
    End With
    GetobjProj = objProj
    End Function
     
    Kelie, Sep 24, 2004
    #1
  2. Kelie

    VBA Guest

    Remember, it's an object so you have to

    Set GetobjProj = objProj
     
    VBA, Sep 24, 2004
    #2
  3. Kelie

    Kelie Guest

    That was the problem. Thanks for your help.
     
    Kelie, Sep 24, 2004
    #3
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.