Tech Support > Microsoft Windows > Development Resources > Linking to DLL from VBA
Linking to DLL from VBA
Posted by Yang Song on May 3rd, 2004


Hi Experts:

I need your help on linking to DLL from VBA. I wrote the DLL with the
DLL Wizard in VC++6 and I am able to link to it in another C++ program.
However, when I try to call the DLL exported function from Excel VBA by
typing the function fnTest2(), it gives a #VALUE! error message. The VBA
code is as follows:

Declare Function fnTest2 Lib "C:\user\ys\dlltest\Debug\test2.dll" ()
As Integer

When I use the same syntax to call the WIN API DLLs(such as user32.dll),
it worked okay.

I greatly appreciate your help.

Yang


Similar Posts