Hi there,
I have the following situation:
1. DOT.NET Application is started
2. DOT.NET Application instantiates Access.Application.8
3. Opens a specified database (MDB)
4. DOT.NET application sets a global variable in the access
application to itself (type object)
5. Runs a macro
6. In the access vba code methods of the DOT.NET application are
called (works fine), this is done within a VBA class.
Problem:
Some of the methods in the DOT.NET application display a WinForm to
the user. Depending on the things the user does, I would need to query
information from the access application. For this I would need some
kind of a callback from the DOT.NET method to the calling vba-object
that originally called the method.
To solve this problem, I thought I can pass the vba-object to the
method as a parameter.
In the DotNet is added a parameter of type "object" to the method.
In the vba-class I added Me as a parameter:
C#: public void Show(object caller, string message) {...
InvokeMethod.... // for callbacks }
VBA: dotnet.Show Me, "Hello"
I get an error message and the problem seems that I cannot pass an
"vba object" to the parameter. Many other data types work just fine,
but I cannot pass a vba object.
Do I need to define a different data type in the C#-method? Is it
possible at all?
Before, I had another architecture, where I implemented a COM-Object
which was then instantiated from VBA in Access. I had big problems,
because displaying a WinForm in the Access97 ActiveX containter is not
supported by microsoft and many things do not work correctly. But
passing an vba object to a C# method had worked with this solution.
Some experts with good ideas would help.
Thanks
Andreas