I am writing a ConsoleApp in C# to open and make some modifications to an Excel workbook, and I am using Microsoft.Office.Interop.Excel. It works quite well, but my goal is to write a dll/xll to do the job with a call from an excel macro. Can that be done, and if yes, how can I get an Excel.Workbook handle attached to the calling Excel process ?
I am rather new to this, so forgive me if I ask silly questions :-)
Yes, you can but writing an xll is an extremely complex process compared to calling
Microsoft.Office.Interop.Excelfrom a console app.To create an xll you need to implement all the relevant functions shown in the XLL SDK. After that, it is simple enough to get a pointer to the
Excel.Applicationinterface.