I have a problem referencing DLL with my VBA code.
My objective is: I have a dll file, code written in C++ (i guess so) and compiled. I have no idea what is coded in there. I have to access this dll from my VBA code, get the result from the dll. My input for the dll is 3 integer values which are in a excel sheet.
I have declared the dll like this Public Declare Function quadratic Lib "C:...\Desktop\Test\quadratic.dll" (ByVal a As Integer, ByVal b As Integer, ByVal c As Integer) As Double (... three dot is just window dir)
On a button click, I read the input values a,b,c from the sheet and call the function passing the arguments like getvalue = quadratic(a, b, c)
I get Microsoft Visual Basic error when running the script, saying "Run-time error '48': File not found: C:...\Desktop\Test\quadratic.dll"
After this I tried to reference this dll using Tools->Reference->Browse and then mapping the dll file kept on my desktop, I get a Microsoft Visual Basic for Application error saying Can'd add a reference to the specified file.
I tried to register the DLL using cmd prompt with command regsvr32 C:...\dllname.dll, which give below error "LoadLibrary("C:\Documents") failed - The specific module could not be found"
I tried to register the DLL with 2nd method on cmd prompt with command rundll32.exe C:...\dllname.dll, which give below error "Error Loading C:\Documents. The specific module could not be found"
I have no clue how to solve this. I tried various ways by changing the VB code, but no joy.
I need, 1. How to reference it using VBA script? 2. How to find the problem in DLL why I cant reference it in VBA?
Please help me at the earliest as it is very urgent.
Regards, Kabilan