PC Review


Reply
Thread Tools Rate Thread

Call UDF by String Name

 
 
=?Utf-8?B?SG9raWV2YW5kYWw=?=
Guest
Posts: n/a
 
      25th May 2007
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


 
Reply With Quote
 
 
 
 
Bob Phillips
Guest
Posts: n/a
 
      25th May 2007
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)

"Hokievandal" <(E-Mail Removed)> wrote in message
news:74668BEC-D984-4854-8529-(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
=?Utf-8?B?SG9raWV2YW5kYWw=?=
Guest
Posts: n/a
 
      25th May 2007
Thanks Bob...

"Bob Phillips" wrote:

> 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)
>
> "Hokievandal" <(E-Mail Removed)> wrote in message
> news:74668BEC-D984-4854-8529-(E-Mail Removed)...
> > 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
> >
> >

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Call a file name from within string etradeguru@hotmail.com Microsoft Excel Programming 3 18th Sep 2007 03:33 PM
sub call with string =?Utf-8?B?YXJhbg==?= Microsoft Excel Programming 5 18th Jun 2005 05:33 PM
Call a property using a string Chad Miller Microsoft VB .NET 2 5th Apr 2004 09:05 PM
String width API call Bob Berry Microsoft Windows 2000 Developer 1 7th Jan 2004 08:59 PM
String width API call msnews.microsoft.com Microsoft Windows 2000 Developer 0 4th Jan 2004 06:07 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:10 PM.