cancel
Showing results for 
Search instead for 
Did you mean: 

Code completion .NET Connector Proxy in VB

Former Member
0 Kudos

Hi,

We are trying to build an Add-In with the SAP Connector Proxy and want to use the functions of the proxy in Excelsheets using the generated proxy.

Unfortunately the code completion suggestions as drop-down-list is only avaliable for the Proxy Object, but not for the routines in it (when typing <ProxyObj>.)

Is there a way to achieve that?

Greetings

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Michael,

As Reiner rightly pointed out, the code completion/auto list would usually work in VS.net unless there is a syntax error. Note that even for obejcts exposed through COM interop (using RCW) the VS.net IDE provides the method info by querying the interface in the type lib.

If I can guess correctly, you have already created the proxy using VS.net and .net connector and you are now trying to invoke methods in the proxy from the VBA code in the excel sheet. In this case the VBA editor would not autolist the routines.

Even I have run into this problem some time back when trying to use .net generated proxy in VBA code. However, in my case I created a new .net solution using VS.net, added the reference to the .net proxy and then simulated the method calls (by passing test arguments to the routines) using a windows forms application. VS.net now provided me all the auto list/code completion features. Once the simulation was done, then it was just a simple paste operation into the VBA editor. . This way although you still dont have code comlpetion features, but at least you should be able to simulate it.

Warm Regards

GJW

Former Member
0 Kudos

Hi Reiner, Hi Gaurav,

Thank you both for your support!

@Gaurav: exactly what my issue is. i think for now this is the way i will go on, especially for procedures with many parameters this helps

Greetings

Michael

reiner_hille-doering
Active Contributor
0 Kudos

If you are using VBA, you are not talking directly with the proxy, but with the COM object that .NET-COM-Inteop creates from it.

I would anyway not recommend to try to use the pure proxy directly from COM: BAPIs often have fairly complex types that need to be mapped to COM type system. This is most likely the place where the problem of VBA happens.

Better "shield" the proxies with some C# or VB.NET classes and expose them to COM with a specially defined COM interface. Set ComVisible to false for all but this interface. I'm sure that .NET-COM-Interop can create a nice easy TypeLib that will be understood by VBA's IntelliSense.

Former Member
0 Kudos

Thank you Reiner!

You are right with your recommendation

The ComVisible Property was the hint. Additionally i had to set the following (perhaps someone will be reading...):

ClassInterface(ClassInterfaceType.AutoDual), ProgId("auniqueidofthecomp")

Now it is working, 10 Points

Answers (1)

Answers (1)

reiner_hille-doering
Active Contributor
0 Kudos

This should definitly work. If it doesn't it usualy has to do with some syntax errors somewhere. Or Visual Studio is somehow confuses ;-).

Which version of NCo do you use? Are the proxies in the same project?

Former Member
0 Kudos

The Connector Proxy Version is 2.0 (you mean that by NCo i think)

The generated Proxy is created as a dll and then this dll is used by an excelsheet. (in vs in same project it works)

reiner_hille-doering
Active Contributor
0 Kudos

What do you mean with Excelsheet?

- Add-In project in Visual Studio written in C# or VB.NET?

- Excel Macro in VBA?

- Excel Application with VSTO (Visual Studio Tools for Office)?