ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Capturing errors in Macros using VB (https://www.excelbanter.com/excel-programming/356905-capturing-errors-macros-using-vbulletin.html)

Priya[_4_]

Capturing errors in Macros using VB
 
Hi,

I have an application written in VB which runs a particular macro in a few
Excel workbooks. Is there a way to capture the errors raised in the macro in
VB? Specifically, I dont want Excel or VBA to display any errors. All errors
must be transfered to the VB code calling the macro. (Err.Raise in the macro
just shows up a dialog with it going into the errorhandler of the calling VB
code.)

Thanks in advance!
Priya



MSweetG222

Capturing errors in Macros using VB
 
Priya -

Try...

MyErrNum = Err.Number
MyErrDescr = Err.Description

This will store the Error # and Description in VBA memory variables. You
can then write code to store to an excel worksheet if you wish.

--
Thx
MSweetG222



"Priya" wrote:

Hi,

I have an application written in VB which runs a particular macro in a few
Excel workbooks. Is there a way to capture the errors raised in the macro in
VB? Specifically, I dont want Excel or VBA to display any errors. All errors
must be transfered to the VB code calling the macro. (Err.Raise in the macro
just shows up a dialog with it going into the errorhandler of the calling VB
code.)

Thanks in advance!
Priya




MSweetG222

Capturing errors in Macros using VB
 
Oops - Sorry, I just noticed you said VB, not VBA.
--
Thx
MSweetG222



"Priya" wrote:

Hi,

I have an application written in VB which runs a particular macro in a few
Excel workbooks. Is there a way to capture the errors raised in the macro in
VB? Specifically, I dont want Excel or VBA to display any errors. All errors
must be transfered to the VB code calling the macro. (Err.Raise in the macro
just shows up a dialog with it going into the errorhandler of the calling VB
code.)

Thanks in advance!
Priya





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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com