NorizonDev
NorizonDev

Reputation: 1

How can I control Excel Add-Ins from a C# Winforms application?

I want to control an Excel Add-In with C# from a Windows Forms Application.

This is what I have so far:

var excelAddin = excelApp.AddIns.Add("C:/.../NWPredict.xlam", Type.Missing);
MessageBox.Show("Predict: " + excelAddin.FullName);

This code works, but how would I start the Add-In and change its settings?

Upvotes: 0

Views: 317

Answers (1)

Andy G
Andy G

Reputation: 19367

If you want to permanently change settings of an add-in then you would need to Open this file, not attach it as an add-in to the currently running instance of Excel. (This isn't usually done programmatically though.)

Perhaps you should clarify because, to me, an add-in is supposed to be "complete". If any settings need to be changed when the add-in is in use, then the add-in itself should make these settings available to the Excel-instance, via exposed properties (or some other technique). But, again, these settings wouldn't be permanently saved (in the add-in itself).

Upvotes: 1

Related Questions