VBA

Moderators: PavlinII
Number of threads: 1614
Number of posts: 3000

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Problems with fortran library Posted by natrix2 on 10 Dec 2012 at 12:24 PM
Hello!!!
I am working with libraries to VBA Excel 2010 (xlsm format), but I have problems in the excel ouputs. This is my script:
* fortran 11
Subroutine FortranDLL( Array1, upbound )
Implicit None
!DEC$ ATTRIBUTES STDCALL, REFERENCE, DLLEXPORT :: FortranDLL
Integer :: upbound
Integer :: Array1(1:upbound)

Integer :: i
do i=1,upbound
Array1(i)=288.16-0.0065*Array1(i)
end do
End Subroutine FortranDLL

* visual basic macro


Option Explicit
Declare Sub fortrandll Lib "fortrandll.dll" (ByRef Array1 As Double, ByRef upbound As Long)

Sub Button1_Click()

Dim II As Long
Dim test(10) As Double

ChDrive (ThisWorkbook.Path)
ChDir (ThisWorkbook.Path)

II = 11
Call fortrandll(test(1), II)
Range("a1").Value = test(1)
Range("a2").Value = test(2)
Range("a3").Value = test(3)
Range("a4").Value = test(4)
Range("a5").Value = test(5)
Range("a6").Value = test(6)
Range("a7").Value = test(7)
Range("a8").Value = test(8)
Range("a9").Value = test(9)
Range("a10").Value = test(10)
End Sub

The problem is that the output is “0” and it isn’t the solution.
Someone know what is wrong?
What is the solution?

Tank!!!!!





 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.