473,405 Members | 2,171 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

COM Interfaces in C# used in a VBA client

Hi,

I'm doing a few POC tests to prove the viability of .Net in anexisting application for a client. Essentially the existing appuses VBA to do various tasks in Excel. I am in the process ofmoving some of the modules out and into various C# classes,providing COM interfaces to allow existing code to use the new"functions" with the minimal amount of change to the clientcode. Up until now I haven't ahd too many headaches,unfortunately that is until I tried to replace a VBA method thatused the ParamArray "type":

Public Function CallProcedure(pstrProcedure As String, ParamArrayparrAllArguments()) As Variant

Obviously my first thought was to write the corresponding C#code:

public object CallProcedure(string Procedure, params object[]AllArguments)

Compiling and then looking at the object in the object browser ofVBA, the C# function looks fine - the definition is exactly asthe original (shown previously). However when I try to actuallyuse it, all hell breaks loose - slight exaggeration I know, butit has caused me quite a headache. VBA throws an error messageas follows:

"Run-time error '450':
Wrong number of arguments or invalid property assignment"

I used the function in the following manner:

varResult = oleDBObj.CallProcedure("STRING1", "STRING2","STRING3", "STRING4")

compared with the original method call:

varResult = CallProcedure("STRING1", "STRING2", "STRING3","STRING4")

You will note there is very little difference (as was myintention) I need to resolve this issue ASAP as obviously if theclient sees that there are issues such as this, they will balkat the idea of .Net

Any help would be GREATLY appreciated...

Kind regards,

James Phillips

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>4vs6qiSrPE+/qY0qSVPOgw==</Id>
Jul 21 '05 #1
0 1120

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Steven T. Hatton | last post by:
In the past there have been lengthy discussiions regarding the role of header files in C++. People have been very adamat about header files serving as in interface to the implementation. I do...
9
by: Code4u | last post by:
My colleagues and I have been discussing techniques for implementing interfaces in C++. We're looking for a mechanism similar to COM's QueryInterface, in which a certain types of objects can be...
9
by: Sean Kirkpatrick | last post by:
To my eye, there doesn't seem to be a whole lot of difference between the two of them from a functional point of view. Can someone give me a good explanation of why one vs the other? Sean
0
by: James Phillips via .NET 247 | last post by:
Hi, I'm doing a few POC tests to prove the viability of .Net in anexisting application for a client. Essentially the existing appuses VBA to do various tasks in Excel. I am in the process ofmoving...
24
by: Rob R. Ainscough | last post by:
VS 2005 I have: ClickOnce deployment User's that hate and or don't want to use an IE Client (don't blame them) I don't see how ASPX web pages are going to survive? With .NET 2.0 and clickonce...
9
by: Terry | last post by:
I am converting (attempting) some vb6 code that makes vast use of interfaces. One of the major uses is to be able to split out Read-only access to an obect. Let me give you a simple (contrived)...
18
by: _dee | last post by:
Question about best use of interfaces: Say there's a 'Master' class that needs to implement a few interfaces: class Master : I1, I2, I3 { } The actual code already exists in smaller...
22
by: RSH | last post by:
Hi, I have been reading on interfaces working on samples I've run across on the web. For the life of me I cannot seem to grasp them. It appears to me that interfaces are simply blueprints to...
23
by: A.Gallus | last post by:
If I declare a function pure virtual: class A { virtual void myfunc() = 0; } and I derive a class from A: class B : public A
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.