Prev: Excel 2007 Routing workbook to Outlook
Next: BACKUP file created when saving Excel Workbook with VBA
From: shatol on 16 Feb 2010 11:49
I've a code on C# that reads the data from Excel's spreadsheet.
I use Excel.Worksheet.get_Range method to get a Excel.Range object like this:
Excel.Range range = Worksheet.get_Range("A1", Missing.Value);
After I got the range I read the data into a multi-dimensional array as
saRet = (System.Object[,])range.get_Value(Missing.Value);
Everything works fine until I want to get only visible cells from the
spreadsheet. So I use the code:
range = range.SpecialCells(xlCellTypeVisible, Missing.Value);
When I try to invoke the range.get_Value(Missing.Value) method I got an
exception that states it cannot cast a string to Object[,].
So, I'm confused about what SpecialCells(xlCellTypeVisible) returns.
Could anyone provide me a hint how to get only visible range from the