Excel function that returns a reference to an object
Posted on 2003-11-03
I want to pass an object to a function and have the function return a reference to the object. I'm new at vb, can this be done?
name As String
value As Integer
Dim v As dt, temp As dt
Set v = New dt
v.name = "pear"
set temp = t(v) 'make temp and v point to the same object
temp.name = "orange" ' this should change v.name too
Range("a1").value = v.name 'make sure it worked
Function t(ByRef a As dt) As dt
set t = a ' assign the location in memory of a to t