Recently, there have been several questions related to the Application.Evaluate method called from Excel VBA. The old XLM macro language also provides the EVALUATE() function. Both can be quite helpful. Does anyone know why an evaluator who is exposed can handle common expressions, though?
My own guess is that Excel was supposed to give people a way to get ranges from string addresses and get the value of named formulas, and just opening the portal to the expression analyzer was the easiest way. (The help for the VBA version speaks about its purpose - "convert the Microsoft Excel name to an object or value.") But, of course, you don't need the ability to evaluate arbitrary expressions just for that. (That is, Excel may provide a Name.Evaluate method or something like that.)
Application.Evaluate seems to be ... unfinished. This complete behavior is not well documented, and there are quite a few quirks and restrictions (as described by Charles Williams here: http://www.decisionmodels.com/calcsecretsh.htm ) with what is exposed.
I believe that the answer may simply be “why not expose it?”, But I would be interested to know what design decisions have led to the fact that this function takes the form that it performs. Otherwise, I would be interested to hear other cramps.
design eval vba excel
jtolle
source share