some months ago I discovered the Excel-DNA project, and integrated it into c#-projects intended for use as excel addins. I am a beginner in .NET/C#/VS'19.
Until now I only mastered making a addin with a Ribbon by loading some xml-code from a VBA-Module. Advantage: I can adapt my Ribbon by changing the vba code without to recompile the addin. All Buttons in the ribbon fire the same OnAction in my Addin.xll :
public void ExecuteCall(IRibbonControl control)
dynamic xlApp = ExcelDnaUtil.Application;
In the vba-code I have procedures that are named like the corresponding Coontrol-IDs.
Is this be intended to be used like this or do you see any problems?
2. Now I wanted to begin to implement some standard forms into my Addin.xll based on WinForms.
For example a form with a Listbox, that Lists entrys given by a passed comma-seperated String. I want to pass the string by a vba-Function calling the form. The form should return the selected value as string.
My starting point was to create a WinForm in my C#-Project and testing to start this from vba.
Within my c#-code I could not handle to show the form from a normal call of method including:
-> it aborts.
I only can handle to get it shown when I put it directly to the Startup of the addin in when it is called from "GetCustomUI"-method.
I also found this links that may are relelated to this topic:
The first sample is very old I cant get the projects run with my VS'19
The second one works fine but is WPF.
Beside my problem to start a simple form with INput/Output from VBA I also would appreciate some direction of what is the start of the Art to handle Excel-DNA and WinForms.
In my opinion there are only old examples out there. May someone could give some code samples or guidlines for this?
I appreciate a lot
Best Regards Rusty