Jag Man
2004-01-17 18:33:05 UTC
I posted this in the Excel Programming NG but so far have gotten no answer.
Perhaps
there are some VBA people?
I have successfully created C++ functions and compiled/linked them into a
DLL,
and called them from VBA after using the Declare statement in the VBA module
where used. However, I need to bind the function to the call at run time,
like can be
in C/C++ using function pointers. One is supposed to be able to do something
like
this using the Application.Run command, but that's where my problem arises.
VBA Help gives a syntax:
expression.Run(Macro, Arg1, Arg2, ...)
where expression evaluates to something that supports the Run method.
"Macro"
is the name of the function to be run. Specifically, it says:
"Macro Required Variant for Syntax 1 (not used with Syntax 2). The macro
to
run. This can be either a string with the macro name, a Range object
indicating where the function is, or a register ID for a registered DLL
(XLL) function. If a string is used, the string will be evaluated in the
context of the active sheet."
I have not been able to make this work for functions that I write and put in
a DLL. Most likely, my problem is I don't know exactly what
" a register ID for a registered DLL (XLL) function" means in this context.
How
does one "register" a DLL function in the sense used here?
TIA
Ed
Perhaps
there are some VBA people?
I have successfully created C++ functions and compiled/linked them into a
DLL,
and called them from VBA after using the Declare statement in the VBA module
where used. However, I need to bind the function to the call at run time,
like can be
in C/C++ using function pointers. One is supposed to be able to do something
like
this using the Application.Run command, but that's where my problem arises.
VBA Help gives a syntax:
expression.Run(Macro, Arg1, Arg2, ...)
where expression evaluates to something that supports the Run method.
"Macro"
is the name of the function to be run. Specifically, it says:
"Macro Required Variant for Syntax 1 (not used with Syntax 2). The macro
to
run. This can be either a string with the macro name, a Range object
indicating where the function is, or a register ID for a registered DLL
(XLL) function. If a string is used, the string will be evaluated in the
context of the active sheet."
I have not been able to make this work for functions that I write and put in
a DLL. Most likely, my problem is I don't know exactly what
" a register ID for a registered DLL (XLL) function" means in this context.
How
does one "register" a DLL function in the sense used here?
TIA
Ed