Is there a way to execute a literal such as,
 UseValueKey = ExecuteMethod("Date()")
I want to have the variable UseValueKey return the actual date.
I am using VBA.
Any ideas?
- 
                        I haven't done any VBA coding for several years, but I recall that Access VBA had an Eval() method that could be used to evaluate code represented as a string. This article gives an example of its usage. 
- 
                        You can try the Eval function. 
- 
                        Perhaps I'm not exactly following you, but you should be able to use Datefor example UseValueKey = date
- 
                        If, as indicated in the question comments, the function name is known and can be delivered as a method on a class, try looking at CallByName object, routine, callTypewhere callType indicates whether the called routine is a property Get/Let/Set or a Method. It feels a lot less kludgey (and somewhat better controlled) than fooling with code evaluation, where you may be leaving yourself open to, er, unexpected consequences... 
 
0 comments:
Post a Comment