Oct 22, 2014 at 2:19 AM
any ideas how I could convert this code in C# to be used in a dll with XL DNA?
res = Application.Match(ModelName, Range("models_names"), 0)
    If IsError(res) Then
        name = "N/A"
        ModelRow = CInt(res)
        name = ModelName
        VceonModelTTest = Range("models_Tjtest")(ModelRow, 1)
   ebd uf
Oct 22, 2014 at 8:56 AM
If you want to use the Excel COM object model in an Excel-DNA application, you can add a reference to the Excel interop assembly (Microsoft.Office.Interop.Excel). That makes the types available in your project.

Then you can get hold of the Application object with a call to ExcelDnaUtil.Application, (the result is of type Microsoft.Office.Interop.Excel.Application and you can access the Application members like Application.Match and Application.Range from there.

Oct 22, 2014 at 4:13 PM
Thanks Govert,
so looking at Microsoft documentation I guess I should be using Application.Range and Application.WorksheetFunction.Match.

But looking at some examples on this site it looks like the suggestions is to use
dynamic xlApp = ExcelDnaUtil.Application;
but then there is no intellisense. Does I have to use the dynamic keyword? Is it possible to assign the type more specifically?

Oct 22, 2014 at 4:24 PM
I found this on a forum:
            // Get the correct application instance
            Excel.Application xlapp = (Excel.Application)ExcelDnaUtil.Application;
            // Get active workbook
            Excel.Workbook wbook = xlapp.ActiveWorkbook;
I'm getting Intellisense we'll see how it goes!
Hopefully I'm on the right track!

Thanks again!
Oct 22, 2014 at 6:20 PM
H Govert,
so I was able to translate the syntax:
Excel.Application xlApp = (Excel.Application)ExcelDnaUtil.Application;
however I'm not sure how to translate this structured reference range:
any ideas?

Oct 22, 2014 at 8:12 PM
Maybe you can try