Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

DLL for VBA

32 views
Skip to first unread message

Jag Man

unread,
Jan 17, 2004, 1:33:05 PM1/17/04
to
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

christo...@gmail.com

unread,
Nov 8, 2017, 4:08:00 PM11/8/17
to
This is an old post, I don´t see an answer here, so making my own contribution.

Did you add a .def file with the name of the functions to the C++ project? I believe that the problem was just it, then you just would have to handle the proper arguments of the functions.
0 new messages