Call UDF by String Name

G

Guest

I've made a custom object with a 'Function' method and need each instance of
the object to call a different UDF. Is there a way if I assign the UDF name
to the object's function as a string to call the function.

For example;
Public Function CalcRainfall(iDate as date) as double
'code to calculate rainfall...
End Function

Public Sub TestCalcRainfall()
Dim sUDF as string

sUDF = "CalcRainfall"

CustomObject.Function = sUDF
' code to run UDF

End Sub

Thanks,
Ryan
 
B

Bob Phillips

Public Function CalcRainfall(iDate As Date) As Double
'code to calculate rainfall...
End Function

Public Sub TestCalcRainfall()
Dim sUDF As String

sUDF = "CalcRainfall"

Application.Run sUDF, Date

End Sub

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
G

Guest

Thanks Bob...

Bob Phillips said:
Public Function CalcRainfall(iDate As Date) As Double
'code to calculate rainfall...
End Function

Public Sub TestCalcRainfall()
Dim sUDF As String

sUDF = "CalcRainfall"

Application.Run sUDF, Date

End Sub

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top