469,317 Members | 1,966 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,317 developers. It's quick & easy.

Passing Access-VBA object to C# method

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
Jul 21 '05 #1
0 1718

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

10 posts views Thread by Rigga | last post: by
2 posts views Thread by Jonathan Driller | last post: by
2 posts views Thread by Morgan | last post: by
4 posts views Thread by hello smith | last post: by
3 posts views Thread by Das | last post: by
1 post views Thread by Dean Slindee | last post: by
4 posts views Thread by arnuld | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by harlem98 | last post: by
1 post views Thread by Geralt96 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.