TheSwamp

Code Red => VB(A) => Topic started by: assafius on July 27, 2014, 09:56:04 AM

Title: Function returns an object
Post by: assafius on July 27, 2014, 09:56:04 AM
Hi,

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 !
 
Title: Re: Function returns an object
Post by: owenwengerd 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>).