ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Programmatically detect a syntax error in a macro? (https://www.excelbanter.com/excel-programming/311363-programmatically-detect-syntax-error-macro.html)

Jeff Beem

Programmatically detect a syntax error in a macro?
 
I'm working on forensice sofware, using vb6, that opens Excel spreadsheets
and generates images of all possible combinations of available data. This
means that one thing we have to do is run the available macros. The problem
is that if we encounter a macro that contains a syntax error the Excel VBA
window opens up and processing doesn't return to our application until the
syntax error is resolved. We would prefer just to note that the particular
macro contains an error and we will just bypass it. Is there a way to detect
syntax errors without having Excel open anything up?

Thanks,

Jeff Beem

Jim Thomlinson[_3_]

Programmatically detect a syntax error in a macro?
 
Nothing that I know of. The error handling in VB6 and VBA is a little cheesy.
Errors are not pushed up the stack, they die with the procedure. If you can
move to vb.net you might be able to resolve this as it uses more classical
error handling.

"Jeff Beem" wrote:

I'm working on forensice sofware, using vb6, that opens Excel spreadsheets
and generates images of all possible combinations of available data. This
means that one thing we have to do is run the available macros. The problem
is that if we encounter a macro that contains a syntax error the Excel VBA
window opens up and processing doesn't return to our application until the
syntax error is resolved. We would prefer just to note that the particular
macro contains an error and we will just bypass it. Is there a way to detect
syntax errors without having Excel open anything up?

Thanks,

Jeff Beem



All times are GMT +1. The time now is 05:05 PM.

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