View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] omyek@yahoo.com is offline
external usenet poster
 
Posts: 1
Default 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