Excel Com Automation
Something interesting:
Using the evaluate function on the worksheet, i pass it a string which
is the actual formula:
=IF(J17<SUM(G17:G25),TRUE,IF(ISBLANK(G26:G37),TRUE ,FALSE))
Now the interesting thing is that i am trying to determine the result.
the result can either be ONLY true or FALSE and i am doing this
Where formula = Dim formula as string =
"=IF(J17<SUM(G17:G25),TRUE,IF(ISBLANK(G26:G37),TRU E,FALSE))"
Dim Results As Boolean
Results = objSheeti.Evaluate(formula)
Now when the values in the excel spread sheet are correct and the
formula does in actual fact return a true value Results =
objSheeti.Evaluate(formula) works but as soon as the formula evaluates
to FALSE (i.e. it SHOULD be returning a false) i get an Array of
values and not just FALSE.... like when the value is right i just get
true:
i get:
- objSheeti.Evaluate(formula) {System.Array} Object
+ (1,1) False {Boolean} Boolean
FalseString "False" String
TrueString "True" String
- (2,1) False {Boolean} Boolean
FalseString "False" String
TrueString "True" String
Why is it returning this and not just FALSE? Is the formula wrong?
What am i doing wrong , or what is the reason for it returning this
value?
Thank you very much
CM
On Sat, 8 Nov 2003 15:03:54 -0500, "Tom Ogilvy"
wrote:
I can't say there are any specific formulas it will not process - the best
would be to just test it. A formula could be
Sum(A1:A10)
That would default to the activesheet in evaluate which may or may not be
what you intended. I was thinking of things such as this that might be a
stumbling block.
Also, I don't think I have ever tested it with Analysis toolpak functions or
UDF's.
|