I have created a 64bit DLL file using Microsoft Visual Studio 2015. Visual C --> Win32 Project.
The code for squareMain.c is as follows :
long _stdcall square(long a)
{
return a*a;
}
The code for Defile.def is as follows :
LIBRARY "square"
EXPORTS
squareforExl=square
I have build the DLL using configuration manager settings set platform and active solution platform to x64 for 64bit DLL.
I have to access this DLL functions through Excel vba7. The function in VBA is as follows :
Private Declare PtrSafe Function squareforExl Lib "C:\math.dll" (ByVal x As Long) As Long
Sub square()
Dim b As Long
b = 5
Dim c As Long
Debug.Print b
c = squareforExl(b)
Debug.Print "Square : " & c
End Sub
While trying to access DLL function squareforExl() as in the code above, it shows the following error msgBox:
Run time Error '53': File not Found :"C:\math.dll"
I have tried placing file in different location directories, even in systems folder.
I have successfully compiled and executed 32bit DLL on in a 32 bit version of Office. My question is how can I access the DLL functions for a 64 bit dll in a 64 bit version of Office ?
C:\math.dllactually exist?Maybe you don't have permission to read this.Did you tryC:\\math.dll? - Gaurav Sehgal