REGISTER.ID Worksheet function

  • Thread starter Thread starter Lurkin Gumby
  • Start date Start date
L

Lurkin Gumby

Hello out there,

I'm trying to convert some (please, no laughing) FORTRAN programs into
DLLs so that I can call them from VB, Excel, etc. I'm using my
Microsoft FORTRAN 5.1 compiler, which is capable of creating Windows
3.0 DLL files.

As a test, I have written a simple FORTRAN function that returns the
product of two integers, and sucessfully compiled it to a DLL.
Unfortunately, I can't get the resulting DLL file to register in Excel
97 using the follwing command:

=REGISTER.ID("c:\windows\system\TESTLIB.DLL", "Test", [type_text])

where I've tried the following values for [type_text]:

"MM"
"MMM"
"1MMM"
"II"
"III"
"1III"

My integer function "Test" takes two integer arguments and returns
their product, but I have also tried rewritting the program as a
subroutine taking three arguments, namely the two arguments and the
product, and modifying the product "in place".

Does anybody out there have any suggestions? Thanks in advance!

Kevin
 
See if the following applies to you:

XL97: Update Available for Excel 97 SR-2 REGISTER.ID Function
Vulnerability
http://support.microsoft.com/default.aspx?scid=kb;en-us;269263

If so, you may have to use a wrapper VBA function to call the Fortran
DLL. Something like the untested:

Option Explicit

Declare Sub DLLTest Lib "<your DLL here>" Alias "Test" ( _
ByVal L1 As Long, ByVal L2 As Long)

Function Test(ByVal L1 As Long, ByVal L2 As Long)
Test = DLLTest(L1, L2)
End Function

Now, you should be able to use Test in the workbook as =Test(12,34)

--
Regards,

Tushar Mehta, MS MVP -- Excel
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top