View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
T Lavedas T Lavedas is offline
external usenet poster
 
Posts: 38
Default Evaluate text formula in VBA

On May 22, 4:05 pm, Gvaram wrote:
Thank you Lavedas, but Bob's solution here is better because it will be
easyer to wright rules like
and([AAA]=[AAB],[BBA]<[BBB]) then
and(""" & AAA & """=""" & AAB & """, """ & BBA & """<""" & BBB & """)

Could you help me with some new problem?
instr([AAA],[AAB])=0 after parsing it becomes
instr("8o6t56-a","8o6t56-b")=0 because AAA and AAB are strings.
Problem is that
Evaluate("instr("8o6t56-a","8o6t56-b")=0") returnes compile error

Is there any solution?

The problem is that your definitions of or the substitution operation
needs to provide more double quotes. The string being evaluated needs
to look like this ...

"instr(""8o6t56-a"",""8o6t56-b"")=0"

for the Evaluate to work. I would suggest that the fix be made in the
variable definition ...

AAA = """8o6t56-a"""
AAB = """8o6t56-b"""

All in all what you are trying to accomplish is very confusing to me.
I really haven't a clue how you plan to implement this - all those
definitions and all the substitutions - how will you ever get them all
right? The code just doesn't seem to be the least bit scalable to me,
but then, as I said, I'm confused.

Tom Lavedas
===========
http://members.cox.net/tglbatch/wsh/