Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Have a .xla add-in that runs a number of routines.
As this may take minutes I set the cursor to xlWait at the beginning of this. Now there is a slight problem with this as if there is a VBA error you are left with the xlWait cursor in the VBE. Would it somehow be possible to catch any VBA error event and then set the cursor back to xlDefault? Thanks for any advice. RBS |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
"RB Smissaert" wrote in message
... Have a .xla add-in that runs a number of routines. As this may take minutes I set the cursor to xlWait at the beginning of this. Now there is a slight problem with this as if there is a VBA error you are left with the xlWait cursor in the VBE. Would it somehow be possible to catch any VBA error event and then set the cursor back to xlDefault? Thanks for any advice. Hi RB, I'm assuming there's some main procedure in your add-in that runs the rest of the procedures. If you place an error handler in this procedure and there are no error handlers in any of the called procedures, then any errors in the called procedures will be caught by the error handler in the main procedure. For example, assume the following is your main procedu Sub MainProcedure() On Error GoTo ErrorHandler SubProcedure1 SubProcedure2 SubProcedure3 Exit Sub ErrorHandler: MsgBox "Error Caught", vbCritical, "Error!" End Sub Any errors that occur in SubProcedures1, 2 or 3 will be caught by the error handler in MainProcedure. Note that the one common case where this does not hold is when you call a procedure with Application.Run. -- Rob Bovey, Excel MVP Application Professionals http://www.appspro.com/ * Take your Excel development skills to the next level. * Professional Excel Development http://www.appspro.com/Books/Books.htm |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
There is a main procedure, but there are lots of called procedures that have
there own error handling. I suppose I will have to re-organize my error handling. RBS "Rob Bovey" wrote in message ... "RB Smissaert" wrote in message ... Have a .xla add-in that runs a number of routines. As this may take minutes I set the cursor to xlWait at the beginning of this. Now there is a slight problem with this as if there is a VBA error you are left with the xlWait cursor in the VBE. Would it somehow be possible to catch any VBA error event and then set the cursor back to xlDefault? Thanks for any advice. Hi RB, I'm assuming there's some main procedure in your add-in that runs the rest of the procedures. If you place an error handler in this procedure and there are no error handlers in any of the called procedures, then any errors in the called procedures will be caught by the error handler in the main procedure. For example, assume the following is your main procedu Sub MainProcedure() On Error GoTo ErrorHandler SubProcedure1 SubProcedure2 SubProcedure3 Exit Sub ErrorHandler: MsgBox "Error Caught", vbCritical, "Error!" End Sub Any errors that occur in SubProcedures1, 2 or 3 will be caught by the error handler in MainProcedure. Note that the one common case where this does not hold is when you call a procedure with Application.Run. -- Rob Bovey, Excel MVP Application Professionals http://www.appspro.com/ * Take your Excel development skills to the next level. * Professional Excel Development http://www.appspro.com/Books/Books.htm |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How can I globally set "error message" parameters in Excel | Excel Worksheet Functions | |||
Catching VbMsgBoxResult | Excel Programming | |||
Catching NewSheet-Event in another WorkBook | Excel Programming | |||
Catching an error | Excel Programming | |||
[how to] VBA catching close/print in printpreview | Excel Programming |