Convert string to expression

  • Thread starter Thread starter WC Justice
  • Start date Start date
W

WC Justice

I have a small vba subroutine that uses an inputbox to collect a fraction,
such as "12.34/56.78", parses the string into numerator and denominator, and
puts the results in a text box--great. I would like to expand its use so
that I can input a compound expression, such as "(12.3*45.6)/78.9", and have
vba recognize it as an expression, rather than a string that needs to be
parsed. Is this possible?

Thanks
 
I think what you are looking for is the eval function
aaa="(12.3*45.6)/78.9"
eval(aaa)
 
Back
Top