I have a GUI I wrote in C#. It's a grid of interactive buttons and text that controls a register map. I would like to create an API for that GUI to use in Excel vba. I have been unable to find any examples or documentation for how to create such a thing, but I have used other companies' object libraries before.
In my attempt to create this, I have ran into some problems, namely it only works on my computer. Also, if I move to another folder on my computer, it also breaks.
Excel vba Code:
Sub Test()
Dim impclass As New ZZVISIBLE_FROM_EXCEL_CLASS
MsgBox impclass.DotNetMethod_SQR(5)
End Sub
C# Library Class Code:
using System;
using System.Collections.Generic;
using System.Text;
namespace ZZVISIBLE_FROM_EXCEL_LIBRARY
{
public class ZZVISIBLE_FROM_EXCEL_CLASS
{
public Double DotNetMethod_SQR(Double input)
{
return input * input;
}
}
}
This foundational example uses C# library class to square a number and Excel VBA to choose the number 5. This is a basic framework for later things I wish to do such as:
grid.writecell(22,1001)
grid.getcell(22)
grid.resetall()
grid.loadfile("C:\griddata\config_default")

Some references for making these object libraries or even what they are called would be most helpful! Googling "custom excel vba references in C#" has led to nothing useful so far, so I decided to post here for help.
Also, I'm early enough in the project that "you're doing it wrong, do this" type answers are welcomed as well!

Microsoft.Interop.Excelhave you tried to google examples on using Interop..?