Home |
Search |
Today's Posts |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi again
Problem solved. It appears that in the Tools-Options-General tab, selecint Error Trapping to "break on all errors" causes this behaviour. I selected "break on unhandled errors" and now the the code jumps to the ErrH "Peter T" wrote: I cannot recreate your problem in XL2K. Others appear to so perhaps it's been introduced in later versions. Following worked as expected for me. Sub test() Dim col As New Collection For i = 1 To 3 col.Add i * 10, Chr(i + 64) Next On Error GoTo errH s = "B" col.Remove s s = "G" col.Remove s ' goes to errh Set col = Nothing Exit Sub errH: Debug.Print s, Err.Number; Err.Description ' G 5 Invalid procedure call or argument Resume Next End Sub Regards, Peter T "BW" wrote in message ... Hello, For some reason when i try to remove a key from a Collection where that key hasn't been added yet, i cannot trap the error when it occurs within an error handler. All i get is a error dialog box that pops up that says "Invalid procedure call or argument" the code snippet is as follows: On Error GoTo ERR_HANDLER myCollection.Remove ("key1") . . . ERR_HANDLER: .code here does not get executed when "key1" does not exist in myCollection. How i can trap this error and continue processing? |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Checking Options in UserForms Collection | Excel Programming | |||
Trap whether it was TAB or arrow keys etc | Excel Programming | |||
Error Trap | Excel Programming | |||
Collection Object Keys | Excel Programming |