Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default vba doesn't trap errors?

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 863
Default vba doesn't trap 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.)

On Mon, 9 Aug 2004 18:40:53 -0700, "bbxrider" wrote:

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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel Throwing Circular Errors When No Errors Exist MDW Excel Worksheet Functions 1 August 10th 06 02:15 PM
Unresolved Errors in IF Statements - Errors do not show in results Markthepain Excel Worksheet Functions 2 December 3rd 04 08:49 AM
How Do I Trap #VALUE! Robert P. Stearns Excel Programming 2 February 18th 04 10:01 PM
error trap Rhonda[_3_] Excel Programming 2 October 22nd 03 07:07 PM


All times are GMT +1. The time now is 11:08 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"