how can I make a standard DLL in C? are these Standard DLL's able to be called from VBA code and return values to Excel? I'm just looking for the easiest way to do this.
Printable View
how can I make a standard DLL in C? are these Standard DLL's able to be called from VBA code and return values to Excel? I'm just looking for the easiest way to do this.
Ohh Thats tooo Easy !
Create a new project in VC++ of type Win32 DLL , and Export functions.Remember to use _stdcall calling convention to be used for all exported function.
Later you can give it's equi. declaration in VB/VBA , and simply use it in EXCEL/WORD/Any VBA Automation supporting app.
how do I give it the equi. declaration in VB/VBA? is there a big conversion needed?
there have been other posts on this before, trying searching for C++ DLL
It's not so hard to write equ. declaration in VB.
C++ 's int is mapped to LONG in VB , C++'s BSTR/Char * are mapped to string.
See following.
int CppFunctionExported(char*lpszName ); //C++
it's equi. in VB is..
Public Declare Function CppFunctionExported Lib "dllName.DLL" (ByVal szName as string) As Long
so simple.. See API text viewer to find more mapping in C++ and VB.