Range Method Numeric Parameters

Jun 26, 2012 at 7:38 PM

Hi Sebastian,

    Very Cool library, I am trying to supply int parameters to a range call, on a worksheet, this works in 2007 interop, but not here. I've traced to the reflection property invoke, it does'nt matter if I use a string paramters or numeric ones.

Any suggestions?



Jun 27, 2012 at 11:05 PM

hey dave,

do you have a code snippet for me?

var v = worksheet.Range(1); // something like this?


Jun 28, 2012 at 7:02 AM

Here you go.

        public static List<String> GetColumnNames(Excel.Range TopLeft)
            List<String> columnNames = new List<String>();
            bool finished = false;
            int top = TopLeft.Row;
            int left = TopLeft.Column;
            int columnCount = 0;
            while (!finished)
                String cellValue = TopLeft.Worksheet.Range(top, left + columnCount).FormulaR1C1.ToString();

Jun 28, 2012 at 7:25 AM

i do 2 tests with interop and netoffice and excel 2007.

var v = worksheet.Range(1,20); // netoffice
var v = worksheet.Range[1,20]; // interop

i got the same exception: HRESULT: 0x800A03EC
but worksheet.Cells(1,20) works fine.

did you use the interop assemblies, the primary interop assemblies or VSTO ?


Jun 28, 2012 at 8:08 AM

Ah the old problem between the keyboard and the chair ;)

There is no overload of Range that takes numeric! sorry to have wasted your time.

my fault, all I can do is plead tirdness in the first ;)

thx Dave