I need to use 'if' conditions built by code
the condition in a string text
see example:
Code: Select all
Sub is_false_or_true_with_string_condition
'1) '' with string
one="red" : two="red"
linecommand0=chr(34) & one & chr(34) & ""="" & chr(34) & two & chr(34)
if linecommand0 then
msgbox "Yes equal " & one
else
msgbox "not equal"
endif
' ------------- work ok
'2) '' with values
one=6 : two=8
linecommand0=chr(34) & one & chr(34) & "">"" & chr(34) & two & chr(34)
if linecommand0 then
msgbox "is mayor " & one
else
msgbox "is minor"
endif
'------- work well
'3) but if the operator is in variable .... errorr...
part1=2 : part2=2 : operat="="
comandline1= chr(34) & part1 & chr(34) & chr(34) & "" & operat & "" & chr(34) & chr(34) & part2 & chr(34)
''' here problem with variable operat << ---
msgbox comandline1
if comandline1 then
msgbox "yes"
endif
' not work....
end sub
How would the arrangement in the code.
thanks!