Coopernick
Coopernick

Reputation: 229

Excel <-> C# - how do I call into a C# library from Excel?

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:

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!

Upvotes: 0

Views: 444

Answers (1)

Eugene Astafiev
Eugene Astafiev

Reputation: 49395

Coopernick,

It looks like you need to develop an Excel add-in and move the VBA code on the add-in rails. See Walkthrough: Creating Your First Application-Level Add-in for Excel to get started quickly. You may consider an Excel add-in as a regular .Net application where you can use any components and libraries.

You may find the Excel Solutions section in MSDN helpful.

Upvotes: 1

Related Questions