Have a class that I can call from vba, so far so good. I need to refer to the new instance of the class that was created in vba and not make a new class.
I'll try to illustrate (I did not include the Com statements as this is just an simplified example)
Given the following code:
VBA CODE
Private WithEvents MyClass
Private Sub MyCommand_Click()
Set c = New MyClass
MsgBox c.i
Set c = Nothing
End Sub
C# CODE
public class MyClass
{
public int i;
public static void Main()
{
var mc = new MyClass(); <<<<< This is the crux of the question- see below
mc.i = 10;
}
}
In the main() function, I need to refer to the class that was already created by the VBA call.
I don't want to create yet another instance.
In pseudo-code, it might look something like this: Set mc = "the class created in VBA"
How to deal with this? Sorry, I know this seems very basic, but I am an old man who last played with vb.6. Feel free to tell me I'm doing it all wrong.