In VBA, check if file is corrupt or not Excel


L

laavista

I'm using Excel 2003.

Using VBA, I am looping through a number of excel files, extracting data
from each, and writing that data into another excel spreadsheet.

Occasionally, there is a Word document in the directory, and once there was
a corrupt Excel spreadsheet.

How do I check if the excel file that I'm trying to open is corrupt or not
in an Excel format?

Your help would be greatly appreciated!
 
Ad

Advertisements

L

laavista

I've tried checking for an error code each time I open a file, but the user
gets an error message from Excel and it stops the program.

Any suggestions?
 
R

Rick Rothstein

Try clicking on Tools/Options... click the General tab on the dialog box
that appears and note which OptionButton is selected in the Error Trapping
panel... if it is "Break on All Errors", then that is your problem... change
the selection to one of the other two (my suggestion is "Break in Class
Module"... it does the same thing as "Break on Unhandled Errors" plus some
additional things).
 
Ad

Advertisements

L

Laavista

Try clicking on Tools/Options... click the General tab on the dialog box
that appears and note which OptionButton is selected in the Error Trapping
panel... if it is "Break on All Errors", then that is your problem... change
the selection to one of the other two (my suggestion is "Break in Class
Module"... it does the same thing as "Break on Unhandled Errors" plus some
additional things).

--
Rick (MVP - Excel)








- Show quoted text -

I will try this right away. Thanks!
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top