having problem with getinterfaceobject

having problem with getinterfaceobject

Anonymous
Not applicable
241 Views
2 Replies
Message 1 of 3

having problem with getinterfaceobject

Anonymous
Not applicable
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
0 Likes
242 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
Remember, it's an object so you have to Set GetobjProj = objProj "Kelie" wrote in message news:7988127.1096047141464.JavaMail.jive@jiveforum2.autodesk.com... > 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
0 Likes
Message 3 of 3

Anonymous
Not applicable
That was the problem. Thanks for your help.
0 Likes