Re: Using fortran code with VBA




"veda" <kedar.hardikar@xxxxxxxxx> wrote in message
news:1183165147.659322.268220@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi,

I have done limited programming with both VBA and FORTRAN (CVF) i.e.
separately. I would like to know how to use VBA for front end while
you use your (existing) fortran code in the background.

If someone can tell me steps to follow for creating simplest project
that illustrates the process, I would appreciate that. I am not
familiar with creating DLLs etc. So, if that is required, I would need
pointers/help for that.

The line of help I am seeking is something like this -

1. Lets say you have a cell in excel where user enters a number
2. Create a "button" for the user to hit that invokes VBA code
"mycode"
3. "mycode" is a VBA code that reads the "input" from the cell and
sends it to a fortran code say "ComputeSquare" e.g. compute the square
of the number (of course, this doesn't need fortran code interface
etc..) and somehow returns to VBA code "mycode"
4. "mycode" then puts that value (squared) in another cell in excel
for user as output.

What I do not know is -

1. What do I need to do after creating "ComputeSquare" in CVF the
usual way so that it can be accessed from VBA? Can "ComputeSquare" be
just a fortran subroutine or is it a full fortran program with its
"main" etc? If it is a DLL, please clarify how do I go about creating
and using it.

2. How do you call "ComputeSquare" (either a full program or a
subroutine) from within VBA and send in the input/output across?

Any help will be greatly appreciated.
Elliot Chandler has made detailed comments on this before. If your google
ability is greater than mine, then you might be able to dig that up with
author and keywords. Gary Scott (I believe) advised to instead use GINO to
make the front end, which next time I want an app with some bells and
whistles, I intend to do.

If you get desperate, he'll probably answer a polite, unsolicited e-mail
epc8@xxxxxxxx .
--
Wade Ward
--


.


Quantcast