Is it possible to return a list of all ranges from all worksheets in an Excel 2002 workbook?

Posted by generalt on Stack Overflow See other posts from Stack Overflow or by generalt
Published on 2010-04-17T01:37:11Z Indexed on 2010/04/17 1:43 UTC
Read the original article Hit count: 327

Filed under:
|
|
|

Hello all.

I want to extract "special" data from an Excel 2002 (client requirement, cannot change) workbook and worksheets contained therein. I have classified ranges in this "special" data category. I would like to acquire a list of all ranges in, ideally, all worksheets in a workbook. The attributes I'm interested in are the range name, and the range address. I have been googling for a while now, and have not found anything relevant.

I was assuming the Excel 2002 API would expose something like this:

ApplicationClass app = new ApplicationClass();
Workbook workbook = app.Workbooks.Open(@"c:\file.xls", ...);
Worksheet worksheet = workbook.Worksheets["sheet1"] as Worksheet;
Range[] ranges = worksheet.GetAllRanges();

or something similar. However, I am sadly mistaken.

Is this possible with Excel 2002?

© Stack Overflow or respective owner

Related posts about excel

Related posts about 2002