I want to create a Windows DLL that I can access the exported function via VBA.

I went to create a Windows DLL, and choes the option that expiorts functions, which created me a simple template project which I modified just a little and then built a release version, everything seemed to go well.

This is my class code

// Test.cpp : Defines the entry point for the DLL application.
//

#include "stdafx.h"
#include "Test.h"

BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}


// This is an example of an exported variable
TEST_API int testVar1=0;

TEST_API int testVar2=0;

// This is an example of an exported function.
TEST_API int fnTest(void)
{
return 42;
}

// This is the constructor of a class that has been exported.
// see Test.h for the class definition
CTest::CTest()
{
return;
}

Now I am no C++ programmer, but this seemd straightforward, and looked as though it should do what I wanted (after provibg it, I would add many more variables of same simple type).

However, in VBA whenI tried to reference the DLL via the browse option, it told me it could not find the DLL (odd as I had browsed to it). If I tried to register the DLL, it returned an error saying that it could not register the dll as the DLLReisterServer entry point was not found.

Can anyone put me on the right track to allow me to access this dll from within VBA.

TIA