View Single Post
  #7  
Old 03-11-2010, 06:22 AM
popx's Avatar
popx popx is offline
Newcomer
 
Join Date: Mar 2010
Location: Oxford
Posts: 16
Question How to Catch An Excel Runtime Error From a WinForm? (In relation to Perl)

Mike and Slim,

I was interested in this because I've been trying to run Excel from Java and from Perl, and am getting what I think is the same problem. Briefly, we have a Web server to which customers can upload spreadsheets, and then run macros in them from Java or Perl. The spreadsheets may have bugs in their VBA, but we don't see these because the uploads are automaic, so we can't edit the VBA to insert "On Error" traps. Hence, we want a way to run a macro such that any VBA-error dialog box, for example the divide-by-zero one, doesn't appear. Otherwise, the spreadsheet hangs for ever waiting for a human to press the dialog box's End button. Mike's explanation of what happens from VB is the clearest I've seen, though I'm not yet sure how to apply it.

I tried Slim's suggestion of disabling events, but it didn't help.

For anyone interested, a detailed description of our problems, with sample Perl code, is on the PerlMonks forum at Win32::OLE: how to call Excel VBA macros and catch all VBA errors without dialog boxes appearing?. I linked back to this thread. Perhaps if the PerlMonks posting gets some answers, they will illuminate Slim's problem too.

Jocelyn Paine

Last edited by Cerian Knight; 03-11-2010 at 10:53 AM. Reason: Re-Merge per Mike's request
Reply With Quote