Author Topic: Function returns an object  (Read 3276 times)

0 Members and 1 Guest are viewing this topic.


  • Guest
Function returns an object
« on: July 27, 2014, 09:56:04 AM »

Wrote a simple code in autocad VBA that for some reason failed to run:

Function myFunc(p As ACAD_POINT) As Object
        Dim r As Object
        myFunc = r
End Function

Sub MySub()
       Dim p1 As ACAD_POINT
       Dim obj As object
       set obj = MyFunc(p1)
End Sub

When I execute MySub I get an error message: "object variable or with block variable not set"

does anyone know why ?

Thanks !


  • Bull Frog
  • Posts: 448
Re: Function returns an object
« Reply #1 on: July 27, 2014, 05:06:04 PM »
You've declared r as Object, but you haven't given it a value (e.g. Set R = <whatever>).