This project has moved. For the latest updates, please go here.

Object ExcelDna.Integration.ExcelReference cannot convert to NetOffice.ExcelApi.Range.

Nov 19, 2012 at 11:50 AM

Hello,

I try write Excel function using ExcelDna and NetOffice

For example:

 

[ExcelFunction(Description = "My description.", IsMacroType = true)]
        public static object GetSize( [ExcelArgument(AllowReference = true)]object cell) {
            if (!(cell is ExcelReference)) {
                return ExcelError.ExcelErrorValue;
            }                    
            Excel.Range  rng = (Excel.Range)cell;           
            return something;            
        }

But I cannot convert xcelDna.Integration.ExcelReference to NetOffice.ExcelApi.Range

I use ExcelDna 0.29, NetOffice 1.5.1.2, Excel 2010 32bit, Win7 64bit and Visual Studio 2008 Pro.

Can you help me? Am I doing something wrong?

Thanks for answer.

Radek

 

 

Coordinator
Nov 19, 2012 at 12:50 PM

hello,

at first: NetOffice has no helpful examples to use Excel-DNA and NetOffice in one solution(failed). as far i known Govert van Drimmelen provides some example solutions here. (Govert are you read this and help?)  

try to use:

NetOffice.ExcelApi.Range range = new NetOffice.ExcelApi.Range(null, cell);

NetOffice wraps all references in own wrapper classes. this is why can't convert a proxy in this way.

Sebastian 

 

Nov 20, 2012 at 6:52 AM

Hello,

thanks for answer

row NetOffice.ExcelApi.Range range = new NetOffice.ExcelApi.Range(null, cell); is now OK

But variable has throw an exeption of type 'System.Runtime.InteropServices.COMException' for all property.

I writed similar function in my past computer and worked correctly, (with Excel 2002)

Any ideas?

Radek

 

 


 


Nov 21, 2012 at 7:30 AM

Hello,

To convert from a native ExcelReference to a COM Range object I need a helper like discussed here: https://groups.google.com/group/exceldna/browse_frm/thread/ceacc4228b3b99ad.

Not it's OK.