Detecting non-supported files using Excel.Open

O

omyek

Hi, I'm using the Excel Ojbect Library 10.0 (the version which comes
with Office XP) and i'm opening user selected Excel files using
Excel.Open().

However, there is the chance a user will select a non-Excel file to be
opened. Is there a way to programmatically determine when this occurs
so that I won't go through with the processing of the file?

In testing, when I select one of these non-Excel files, a dialog pops
up saying I've opened an unsupported file, do I want to continue . . .

I've tried putting the Excel.Open statement in a try/catch (in C#),
however it seems the program blows by the dialog box and continues to
open the file even though it's unsupported.

Which is weird . . . when debugging, I get the dialog but when I'm not
debugging and just running the exe alone, i don't get the dialog.

Any ideas?

Thanks,
Alfred
 

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