- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have attempted to call a Fortran DLL from Excel with no success. The code converts either (1) a Latitude Longitude location to Section, Township, Range or (2) vice versa.Thefortran source codemay be found here:
http://www.geocities.com/jeremiahobrien/download.html
Can someone assist me?
Thanks,
Jim
Option Explicit
Private Sub CommandButton1_Click()
trsm = InputBox("Enter Section/Township/Range")
meridian = InputBox("OPTIONAL/enter meridian")
state = InputBox("OPTIONAL/enter state XX")
Call trsm2ll(trsm, Len(trsm), meridian, Len(meridian), state, Len(state), lat, lng, lerror)
MsgBox "latitude=" & lat & " longitude=" & lng & " error=" & lerror & " trsm=" & trsm & " state=" & state & " meridian=" & meridian
End Sub
Private Sub CommandButton2_Click()
lat = InputBox("enter Latitude xx.xxx")
lng = InputBox("enter Longitude xxx.xxx")
state = InputBox("OPTIONAL/enter state XX")
Call ll2trsm(lat, lng, trsm, Len(trsm), meridian, Len(meridian), state, Len(state))
MsgBox "TRS=" & trsm & " Meridian=" & meridian & " state=" & state
End Sub
Option Explicit
Public lerror As Integer
Public lat As Single
Public lng As Single
Public state As String * 2
Public meridian As String * 2
Public trsm As String * 16
Declare Sub trsm2ll Lib _
"TRSM2LL.DLL" _
(ByVal trsm As String, ByVal l1 As Long, _
ByVal meridian As String, ByVal l2 As Long, _
ByVal state As String, ByVal l3 As Long, _
lat As Single, _
lng As Single, _
lerror As Integer)
Declare Sub ll2trsm Lib _
"LL2TRSM.DLL" _
(lat As Single, _
lng As Single, _
ByVal trsm As String, ByVal l1 As Long, _
ByVal meridian As String, ByVal l2 As Long, _
ByVal state As String, ByVal l3 As Long)
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Do a forum search for 'Fortran DLL EXCEL' and you will find loads of advice. You could start here http://software.intel.com/en-us/forums/showpost.php?p=3886
If you are sending strings, I would make them 'by ref' and put them at the end. They would need to be given the REFERENCE attribute in the Fortran.
Where is your Fortran code by the way?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The Fortran DLL is in the c: oot directory. I have not re-compiled under the Intel Fortran Compiler yet but downloaded the DLL's from the referenced web site in my post.
Thanks,
Jim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok, so this is not related to Intel Fortran at all? You have a DLL someone else built and are trying to use it from Excel. What exactly is the problem you encounter?
I find that I have to put the full path to the DLL in the VBscript code unless perhaps the DLL is located where the Excel application itself is located. C:ROOT is not generally a meanintgful directory in Windows.
If you need more help, perhaps you can ask the DLL author who promises to respond to emails.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page