I have a sub (macro) in Excel that I want to be able to call from Access, which looks like this:
Sub myMacro(param1 as string, param2 as string)
...
End Sub
In Access, I have:
xlBook.Application.Run "myMacro", string1, string2
But I get the error :
Runtime Error 450:
Wrong number of arguments or invaluid property assignment
How do I pass multiple parameter to Excel?
As per @Remou’s comment, I checked the variable types being passed.
In this case,
string2was a Variant that was supposed to hold a String of numbers, but when the string of numbers got stored instring2(the Variant), it was converted to a number (stored within a variant [?]).Nonetheless, stricter (and thus correct) type declarations solved the issue.