Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Accessing value in a range using Automation in a C# DLL
Greetings I followed the steps in this blog here to create my C# DLL that
contains my excel 2003 UDFs: http://blogs.msdn.com/eric_carter/ar...01/273127.aspx The problem I am having is when I pass in a range of cells from excel into my function which resides inside my Automation DLL I just cannot figure out how to access the cell values individually. Here is an example of my functions: public double SecondValueIs(object Range) { int SecondCell= 0; Excel.Range r = Range as Excel.Range; //What code do I put here to get the second cell if its a one row range? //lets say that I passed in A1:A5? // //object value = r.Cells[1,2].value DOES NOT work no VALUE method ... //string value = r.Cells[1,2] DOES NOT work .. cant convert COM object to string ... return SecondCell; } If I look inside r.FormulaLocal for instance I can see a list of my cell values but I cant convert or otherwise manipulate them. There HAS to be a way to do so. What am I doing wrong? Thank you in advance for your time. ~Rob. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Accessing a variable(a range) and modifying it | Excel Programming | |||
Accessing specific items in a range | Excel Programming | |||
Excel Automation Add-In, Accessing the application object | Excel Programming | |||
Range.Formula and Range question using Excel Automation | Excel Programming | |||
Accessing/Clearing range in hidden workbook | Excel Programming |