Convert string to expression

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
 
G

Guest

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top