ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Detecting non-supported files using Excel.Open (https://www.excelbanter.com/excel-programming/280987-detecting-non-supported-files-using-excel-open.html)

[email protected]

Detecting non-supported files using Excel.Open
 
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


All times are GMT +1. The time now is 02:41 AM.

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