Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 172
Default Error Handler and Error 1004

I have been using an Error Handler in a routine. I have
been getting an Error 1004. When I use the Error Handler,
the routine seems to go to the Error Handler but does not
bring up the message box as dictated by the Error
Handler. Is this because Error 1004 is an error generated
outside of VBA? Note that when I do not use the Error
HAndler code, VBA naturally displays an error alert with
the error number (1004). Why does this not still happen
when I use this error handler?


On Error Goto Err_Hndlr

'Code here

CleanUp:
Application.StatusBar = ""
Application.ScreenUpdating = True
Other stuff to clean up
Exit Sub

Err_Hndlr:
MsgBox Err.Number & Err.Description
Resume CleanUp

End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Error Handler and Error 1004

I don't see anything wrong with the code you presented. It might be in
something you didn't show as, fleshing out your example, the message box
appears for me:

Sub a()
Dim x As Integer
On Error GoTo Err_Hndlr
x = 1 / 0
CleanUp:
MsgBox "exiting"
Exit Sub

Err_Hndlr:
MsgBox Err.Number & " " & Err.Description
Resume CleanUp
End Sub


--
Jim Rech
Excel MVP
"ExcelMonkey" wrote in message
...
|I have been using an Error Handler in a routine. I have
| been getting an Error 1004. When I use the Error Handler,
| the routine seems to go to the Error Handler but does not
| bring up the message box as dictated by the Error
| Handler. Is this because Error 1004 is an error generated
| outside of VBA? Note that when I do not use the Error
| HAndler code, VBA naturally displays an error alert with
| the error number (1004). Why does this not still happen
| when I use this error handler?
|
|
| On Error Goto Err_Hndlr
|
| 'Code here
|
| CleanUp:
| Application.StatusBar = ""
| Application.ScreenUpdating = True
| Other stuff to clean up
| Exit Sub
|
| Err_Hndlr:
| MsgBox Err.Number & Err.Description
| Resume CleanUp
|
| End Sub
|


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
Run time error 1004, General ODBC error [email protected] New Users to Excel 0 September 19th 05 01:41 AM
Runtime error '1004' General ODBC error star_lucas New Users to Excel 0 August 29th 05 04:09 PM
Excel 2003 Macro Error - Runtime error 1004 Cow Excel Discussion (Misc queries) 2 June 7th 05 01:40 PM
Interior class error/runtime error 1004 David Goodall Excel Programming 1 October 24th 04 10:16 PM
Error Handler not handling error... Daniel Bonallack[_2_] Excel Programming 2 July 22nd 03 09:01 AM


All times are GMT +1. The time now is 08:35 AM.

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"