![]() | ![]() | ![]() |
| |||||||
| Forums | Register | Groups | Awards | Arcade | Pets | T-Bucks / T-Store | Invite Your Friends | Blogs | Mark Forums Read |
| Microsoft Applications Discussions about Windows and other MS Products such as Office |
![]() |
| | LinkBack | Thread Tools |
| | #1 (permalink) |
| Civilians | A procedure often Number Overflow. So I put this handler in procedure. Private Sub Hint() On Error GoTo Overflow ....... ' Some codes. Exit Sub Overflow: If (Err = 6) Then ......' Handling error. End If End Sub but if other Error happen. it could be a unhandle error. because I not handing all err number. |
|
| | #2 (permalink) |
| Civilians | Hi I suggest a Select Case structure on err number, like this: Sub test() Dim i As Long On Error GoTo ErrHandler i = 23232323232323# ^ 2 MsgBox "i=" & i i = 23 / 0 MsgBox "i=" & i Exit Sub ErrHandler: Select Case Err.Number Case 6 MsgBox "Overflow" i = 500 Resume Next Case 11 MsgBox "Div 0" i = 0 Resume Next Case Else MsgBox Error, Err.Number End Select End Sub You may find a list of errors useful when you work on this. Run this on a blank worksheet: Sub ErrorList() Dim L As Long Dim R As Long On Error Resume Next For L = 1 To 1000 Err.Raise L If Error <> "Application-defined or object-defined error" Then R = R + 1 Cells(R, 1).Value = Err.Number Cells(R, 2).Value = Error End If Err.Clear Next End Sub HTH. Best wishes Harald "Cactus [ΟΙΘΛΗς]" <a@b.com> skrev i melding news:u1OvdNAFFHA.3416@TK2MSFTNGP09.phx.gbl... > A procedure often Number Overflow. > So I put this handler in procedure. > > > Private Sub Hint() > > On Error GoTo Overflow > ...... ' Some codes. > Exit Sub > > Overflow: > If (Err = 6) Then > .....' Handling error. > End If > > End Sub > > > but if other Error happen. > it could be a unhandle error. > because I not handing all err number. > |
|
| | #3 (permalink) |
| Civilians | Harald Well, that Err Number List is great. Can I using this way? Throws Err to default handler. Overflow: If (Err = 6) Then .....' Handling error. Else Err.Raise Err End If > Hi > > I suggest a Select Case structure on err number, like this: > > Sub test() > Dim i As Long > > On Error GoTo ErrHandler > > i = 23232323232323# ^ 2 > MsgBox "i=" & i > > i = 23 / 0 > MsgBox "i=" & i > > Exit Sub > > ErrHandler: > Select Case Err.Number > Case 6 > MsgBox "Overflow" > i = 500 > Resume Next > Case 11 > MsgBox "Div 0" > i = 0 > Resume Next > Case Else > MsgBox Error, Err.Number > End Select > End Sub > > You may find a list of errors useful when you work on this. Run this on a > blank worksheet: > > Sub ErrorList() > Dim L As Long > Dim R As Long > On Error Resume Next > For L = 1 To 1000 > Err.Raise L > If Error <> "Application-defined or object-defined error" Then > R = R + 1 > Cells(R, 1).Value = Err.Number > Cells(R, 2).Value = Error > End If > Err.Clear > Next > End Sub > > > HTH. Best wishes Harald > > > > "Cactus [ΟΙΘΛΗς]" <a@b.com> skrev i melding > news:u1OvdNAFFHA.3416@TK2MSFTNGP09.phx.gbl... > > A procedure often Number Overflow. > > So I put this handler in procedure. > > > > > > Private Sub Hint() > > > > On Error GoTo Overflow > > ...... ' Some codes. > > Exit Sub > > > > Overflow: > > If (Err = 6) Then > > .....' Handling error. > > End If > > > > End Sub > > > > > > but if other Error happen. > > it could be a unhandle error. > > because I not handing all err number. > > > > |
|
![]() |
| Bookmarks |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| ROM Upgradation problems with iPAQ 3835 - Error: 101 & Error 113 | Kaustubh Nirmal | Microsoft Applications | 1 | 07-23-2004 20:55 |
| ROM Upgradation problems with iPAQ 3835 - Error: 101 & Error 113 | Kaustubh Nirmal | Microsoft Applications | 1 | 07-23-2004 20:42 |
| ROM Upgradation problems with iPAQ 3835 - Error: 101 & Error 113 | Kaustubh Nirmal | Microsoft Applications | 1 | 07-23-2004 20:25 |
| Error - Compile Error in Hidden Module: AutoExec | Big Rhino | Microsoft Applications | 1 | 06-16-2004 20:40 |
| What would you do/How would you handle this? | Betty Boop | Chit-Chat | 40 | 04-22-2004 09:56 |
![]() | ![]() | ![]() |