?
Solved

vba error code not catching error number

Posted on 2014-04-09
4
Medium Priority
?
377 Views
Last Modified: 2014-04-09
vba 2010.
excel

I have code that is to capture a specific error number.

It is not catching the error 424 ?


ErrHandler:
If Err.number = 424 Then
         MsgBox "You May Have Data that Contains Extra Special Characters.Please Verify Your Cut and Paste or Typing entry.", vbCritical, "Description Search Error" 'On Error Resume Next
    rs.Close
     db.Close
       Set rs = Nothing
         Set db = Nothing
           UserForm2.ListBox47.Clear
Exit Sub
End If



Thanks
fordraiders
0
Comment
Question by:fordraiders
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 27

Accepted Solution

by:
MacroShadow earned 1000 total points
ID: 39989319
If you comment the error handling do you run into an error? If so type in the immediate window (ctrl+G to open it):
?Err.Number
Hit enter. What is the number?

Alternatively attach a sample so we can debug it.
0
 
LVL 49

Assisted Solution

by:Martin Liss
Martin Liss earned 1000 total points
ID: 39989487
Please show the complete procedure that contains that code.
0
 
LVL 34

Expert Comment

by:Norie
ID: 39989566
Perhaps some other error has occured before the 424 error you expect?
0
 
LVL 3

Author Closing Comment

by:fordraiders
ID: 39990732
Thanks..commented and found a previous error.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
This article describes a serious pitfall that can happen when deleting shapes using VBA.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question