vba doesn't trap errors?

  • Thread starter Thread starter bbxrider
  • Start date Start date
B

bbxrider

excel 2000/vba

i had some code like this:
select case passedVariable
case "someText" or someVariable & "someText"
but no matter what value was passed the above case always executed!!!

so then tried it in vb6.0 and the 'or' statement generated a type mismatch
error

so then in the vba code i tried
case "someText" , someVariable & "someText"
replacing the 'or' with the ',' (comma) seems to work ok

so it seems the bad syntax of using 'or' in the case statement just caused
faulty program execution instead of trapping an error????

if this is so, is there some way to turn on error trapping, or test to find
syntax and/or other programming errors
 
I am using Excel 2002, and your bad line would not compile for me. I got a
"type mismatch" error. (VBA's OR is a bit-wise OR, and it works only on
numeric variables.)
 

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

Back
Top