Click here to Skip to main content
15,890,825 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
we are trying to retrieve a calculated value from a cell which has add-In (VBA) formulas in it.

The sample add-in "myUtilityl.xla" is working properly in excel.
It retrieves value for the addin function =ISOWEEKNUM(F9).
But we are unable to retrieve the value in our application using C# & Microsoft Object Library.

The add-In "myUtilityl.xla" is attached to Excel. Environment is VS2010

I am providing the sample code here.
C#
string path = @"C:\Test.xls";
        Workbook theWorkbook;
        Worksheet theWorksheet;
        Range readRange;
        Microsoft.Office.Interop.Excel.Application app = new Microsoft.Office.Interop.Excel.Application();            
        theWorkbook = app.Workbooks.Open(path);
        Sheets theSheets = (Sheets)theWorkbook.Worksheets;
        theWorksheet =  (Worksheet)theWorkbook.Worksheets.get_Item("Sheet1");            
        readRange = theWorksheet.get_Range("B1");            
        MessageBox.Show(Convert.ToString(readRange.Value));
        //theWorkbook.Save();
        app.Workbooks.Close();

I am new to Microsoft Object library. Any help or clue will be very helpful.
Regards,
Jinto.
Posted
Updated 3-Jan-12 23:07pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900