How to pass parameters from VBA to a DLL file or an API
How to pass parameters from VBA to a DLL file or an API
I'm trying to delegate a huge processing VBA code to an outside application. My outside application can be a DLL file or an API.
To do that I need to pass parameters from VBA to a DLL file Or the API. These parameters can be string, integer or an Array.
I already found an example on how to pass Integers from VBA to DLL file
this is my C# code that have as an input three integers which will be sent by VBA. In this example I just generate the DLL file and I call it in VBA, but I need to do the same with arrays.
[Guid("A33BF1F2-483F-48F9-8A2D-4DA68C53C13B")]
[ClassInterface(ClassInterfaceType.AutoDual)]
[ComVisible(true)]
public class MyFunctions
public MyFunctions()
public double MultiplyNTimes(double number1, double number2, double timesToMultiply)
double result = number1;
for (double i = 0; i < timesToMultiply; i++)
result = result * number2;
return result;
How can I pass arrays from VBA TO DLL file or API ?
How do you invoke this code from your VBA? How do you pass values to it? What happens when you try passing a more complex type?
– David
Sep 18 '18 at 11:27
This is what i'm asking @David I need to do the same thing with more complexe variable types like arrays or matrixs and not only integers.
– Soufien Hajji
Sep 18 '18 at 11:41
@QHarr it's all in the response of this question : stackoverflow.com/questions/37074533/…
– Soufien Hajji
Sep 18 '18 at 11:41
Pass an array from vba to c# using com-interop ?
– Alex K.
Sep 18 '18 at 12:23
0
Thanks for contributing an answer to Stack Overflow!
But avoid …
To learn more, see our tips on writing great answers.
Required, but never shown
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy
Where is your vba code?
– QHarr
Sep 18 '18 at 11:25