I have an issue with VSTO in Visual Studio 2005, for Excel 2007.
Basically, in some scenarios looking up a named range of a sheet will not work, and it just errors.
Here is the process..
1, Template sheet is copied from a template workbook into the users excel workbook
2, This new sheet is populate from a dataset (from SQL)
3, All works fine
4, User selects a different template sheet from the same template workbook
5, it gets copied over
6, failed when looking up named ranges of the new sheet
Interestingly it only fails when the formatting of the template sheet is NOT a string.
Here is the line that it fails on (the same code which works the first time)
Excel.Range r = currentWorkbook.Names.Item(namedRange, Type.Missing, Type.Missing).RefersToRange;
I have tried:
* changing the culture to US and GB
* removing all sheets from the user workbook then inserting a new one
* writing a different process for range lookup (same result)
Note: If you relaunch the application, and copy the sheet that failed the last time it all works fine. But the sheet that works last time now has the issue!!
It's as if something is 'hanging around' and causing an issue.. but I can't for the life of me figure out what...
Question
BGM
Hi,
I have an issue with VSTO in Visual Studio 2005, for Excel 2007.
Basically, in some scenarios looking up a named range of a sheet will not work, and it just errors.
Here is the process..
1, Template sheet is copied from a template workbook into the users excel workbook
2, This new sheet is populate from a dataset (from SQL)
3, All works fine
4, User selects a different template sheet from the same template workbook
5, it gets copied over
6, failed when looking up named ranges of the new sheet
Interestingly it only fails when the formatting of the template sheet is NOT a string.
Here is the line that it fails on (the same code which works the first time)
I have tried:
* changing the culture to US and GB
* removing all sheets from the user workbook then inserting a new one
* writing a different process for range lookup (same result)
Note: If you relaunch the application, and copy the sheet that failed the last time it all works fine. But the sheet that works last time now has the issue!!
It's as if something is 'hanging around' and causing an issue.. but I can't for the life of me figure out what...
any help would be much appreciated!
chris
Link to comment
Share on other sites
0 answers to this question
Recommended Posts