I'm trying to define a function in a type library that takes a variable number of parameters and can be callable from VBA using ParamArray. The entry in the type library is below.
[
helpstring("Get value from a Lookup table by an exact key."),
entry("UtilDll_LookupExact"),
vararg
]
HRESULT __stdcall LookupExact(
[out] LPVARIANT Result,
[in] LPVARIANTARG Table,
[in] LONG VarIndex,
[in] SAFEARRAY(VARIANT) Key,
[out, retval] VARIANT_BOOL *Found
);
I can see this VBA's object browser as:
Function LookupExact(Result, Table, VarIndex As Long, ParamArray Key() As Variant) As Boolean
So, at least the object browser seems to understand Key as ParmArray () Variant. But when I call this function I get a compile error saying, "Compile Error: Function or Interface Marked as Restricted, or the Function Uses an Automation Type Not Supported in Visual Basic"
The closest question I found is below, but this case seems specific to managed code while I'm dealing with native code. ParamArray Not Working With COM
How can I make a function in native code that has the ParamArray parameter and can be accessed via VBA?