We have a couple of spreadsheets here that we populate with some data and do some formatting using Microsoft.Office.Interop.Excel
.
Now that part is all good - it's something along the lines of what is done here: Write to Excel example.
What I'd like to do is:
- Add a button inside the spreadsheet, bound to a macro.
- When the user clicks the button, the macro fires - we grab some parameters from the cells and pass those to the C# function. That code does all the heavy lifting, populates the spreadsheet as above, etc.
What I don't understand how to do is that second step - I can't see a way to actually pass parameters and call into C# directly. As it stands now, I can call a C# console application and pass command line parameters into it... but that seems a bit wrong, I'd have thought there would be some better way - but I can't seem to find it!