Retrieving macro and formula details from Excel

Mar 11, 2015 at 9:04 AM
Hi Govert,

I was searching for a perfect solution to access excel workbooks in terms of macros & formulas and I came to know about your application in codeplex. However I couldn’t really use the Excel.Integration assembly in my application it was saying the handle is not available and so on.

I am trying to retrieve the following information from an excel workbook/worksheet whenever my application encounters an active window and if its an excel application. I am using .Net Framework 4.0 and MS Visual Studio 2010 for my development.
  1. Number of macros
  2. Total number of lines of code (macros)
  3. Formula availability
  4. Is workbook/worksheet protected
  5. Workbook/worksheet name
  6. Excel BuiltinDocumentProperties
Could you please help in getting these information using ExcelDna (I mean way in which all these information can be retrieved). Your help will be really helpful in getting all these information.
Mar 11, 2015 at 6:25 PM

It doesn't sound like Excel-DNA is the right approach for you. It is mainly a library for making Excel add-ins.

From another application, you would use the COM automation to talk to Excel.
Add a reference to Microsoft.Office.Interop.Excel.dll, Office.dll and Microsoft.Vbe.Interop.dll to your project, and continue from there.

Mar 12, 2015 at 6:42 AM

Thanks for your response.

While going through your Excel-DNA source code I found that the Application property under the ExcelDnaUtil class returning the active excel application. So thought of using the same for my application. But eventually it dint work out as a separate assembly referenced to my project. And as you mentioned it already has all the Interop and Core office assemblies as its reference.

Will try out those assemblies directly in my project. Thanks again.