check if a sheet exists in excel
Posted
by ps
on Stack Overflow
See other posts from Stack Overflow
or by ps
Published on 2010-04-27T15:48:09Z
Indexed on
2010/04/27
15:53 UTC
Read the original article
Hit count: 344
excel-2007
|interop
How do i check if a sheet exists in a excel using interop. I tried the following but it throws an COMException if not there.. Is there a better way of finding out than actually looking at the exception
Worksheet sheet = null;
Sheets worksheets = some;
sheet = (Worksheet)worksheets.get_Item("sheetName");
if(sheet!=null)
{
//do something
}
© Stack Overflow or respective owner