I'm having a problem calling a Visual FORTRAN subroutine located
in a .dll from an Excel VBA macro. I followed the fantastic article
by Lorri Menard, Calling Visual Fortran from Visual Basic from the
Newsletter Issue I, February 1998.
While this works file when I'm running Excel 97 on Windows 98
(where the dll was built), I have problems using this application on
other platforms. Specifically, Excel 97 on Windows 95 and Excel
for Office 2000 on Windows 2000. Excel returns an error saying
my dll file is not found.
I'm using Compaq Digital FORTRAN Professional Edition 6.1.0 to
create a dll that contains one small subroutine with no parameters.
I use the following export line:
!DEC$ ATTRIBUTES DLLEXPORT::DLLTEST
I build my dll no problem and place it in a specific directory,
In my Excel macro I have the following DECLARE statement:
Public Declare Sub DLLTEST Lib "c:mydirdlltest.dll" ()
and the following CALL statement in my macro:
It runs fine in this configuration on Win98/Excel 97.
When I run my macro on the problem systems, I receive an
error from Excel: run time error 53 file not found c:mydirdlltest.dll.
I have also received run time error 48 file not found. The dll file is
definately in the directory, but Excel can not find it or doesn't like it.
I have tried placing my dll file in a directory in my path, and removing
the fully qualified portion of the filename in the DECLARE statement.
I get the the same error.
I looked around in the Microsoft knowledge base. There are articles
that indicate this type of error could have been caused by 32-bit Excel
calling a 16-bit dll or if I was using the _cdecl calling convention in
Excel 97. As far as I can tell, my dll is 32 bit and Win95/Win2000 are
32 bit, and I'm using the standard calling convention as opposed to
I built the dll in visual fortran installed on Windows98, will I have to
build dlls on Win95 or Win2000 to get my application to work there?
Anyone run into this type of problem? Or have any ideas on a solution?
Thanks for any information,