C
cseeton
I have a piece of code that takes a small bit of time to iterate on (couple
of seconds). I have generated the dll and it ran fine with Excel 2007 and it
seemed to work well, but now the excel VBA just skips over calls that take
any time (seconds) to execute. If I go into debug mode for the VBA and pause
after the call the code completes, the results are passed into Excel. Is
there any way to force VBA to wait for the results is there a timeout issue I
am running into?
Many thanks.
Chris
----
Still having trouble here is some quick code I put toghether...
The visual Fortran part...
subroutine TESTXLdll (x,num,FT,ierr,herr)
implicit double precision (a-h,o-z)
implicit integer (i-k,m,n)
character herr*255
!DEC$ ATTRIBUTES DLLEXPORT, Alias: "_TESTXLdll"::TESTXLdll
!DEC$ ATTRIBUTES STDCALL, REFERENCE::TESTXLdll
!add loops to add time to calculations
FT=0.0
ierr=0
if (x.gt.0.d0) then
do i=1,num
do j=1,num
FT = FT + Dlog(x)/DLog(10.d0)
enddo
enddo
else
ierr = 1
endif
if (ierr.eq.0) then
herr = "ok"
else
herr = "error, x<0"
endif
end
subroutine TESTXLdll (x,num,FT,ierr,herr)
implicit double precision (a-h,o-z)
implicit integer (i-k,m,n)
character herr*255
!DEC$ ATTRIBUTES DLLEXPORT, Alias: "_TESTXLdll"::TESTXLdll
!DEC$ ATTRIBUTES STDCALL, REFERENCE::TESTXLdll
!add loops to add time to calculations
FT=0.0
ierr=0
if (x.gt.0.d0) then
do i=1,num
do j=1,num
FT = FT + Dlog(x)/DLog(10.d0)
enddo
enddo
else
ierr = 1
endif
if (ierr.eq.0) then
herr = "ok"
else
herr = "error, x<0"
endif
end
the Excel part:
Option Explicit
Private Declare Sub TESTXLdll Lib "XLTest.dll" (x As Double, num As Long, FT
As Double, ierr As Long, ByVal herr As String, ln As Long)
Private herr As String * 255
Private ierr As Long
Private num As Long, x As Double
Function Test(x, num)
Dim FT As Double
If x < 0 Or num < 0 Then Test = "Input(s) is LT zero": Exit Function
Call TESTXLdll(x, num, FT, ierr, herr, 255&)
Test = FT
If ierr <> 0 Then Test = "Error, Error, Error"
End Function
Delete
of seconds). I have generated the dll and it ran fine with Excel 2007 and it
seemed to work well, but now the excel VBA just skips over calls that take
any time (seconds) to execute. If I go into debug mode for the VBA and pause
after the call the code completes, the results are passed into Excel. Is
there any way to force VBA to wait for the results is there a timeout issue I
am running into?
Many thanks.
Chris
----
Still having trouble here is some quick code I put toghether...
The visual Fortran part...
subroutine TESTXLdll (x,num,FT,ierr,herr)
implicit double precision (a-h,o-z)
implicit integer (i-k,m,n)
character herr*255
!DEC$ ATTRIBUTES DLLEXPORT, Alias: "_TESTXLdll"::TESTXLdll
!DEC$ ATTRIBUTES STDCALL, REFERENCE::TESTXLdll
!add loops to add time to calculations
FT=0.0
ierr=0
if (x.gt.0.d0) then
do i=1,num
do j=1,num
FT = FT + Dlog(x)/DLog(10.d0)
enddo
enddo
else
ierr = 1
endif
if (ierr.eq.0) then
herr = "ok"
else
herr = "error, x<0"
endif
end
subroutine TESTXLdll (x,num,FT,ierr,herr)
implicit double precision (a-h,o-z)
implicit integer (i-k,m,n)
character herr*255
!DEC$ ATTRIBUTES DLLEXPORT, Alias: "_TESTXLdll"::TESTXLdll
!DEC$ ATTRIBUTES STDCALL, REFERENCE::TESTXLdll
!add loops to add time to calculations
FT=0.0
ierr=0
if (x.gt.0.d0) then
do i=1,num
do j=1,num
FT = FT + Dlog(x)/DLog(10.d0)
enddo
enddo
else
ierr = 1
endif
if (ierr.eq.0) then
herr = "ok"
else
herr = "error, x<0"
endif
end
the Excel part:
Option Explicit
Private Declare Sub TESTXLdll Lib "XLTest.dll" (x As Double, num As Long, FT
As Double, ierr As Long, ByVal herr As String, ln As Long)
Private herr As String * 255
Private ierr As Long
Private num As Long, x As Double
Function Test(x, num)
Dim FT As Double
If x < 0 Or num < 0 Then Test = "Input(s) is LT zero": Exit Function
Call TESTXLdll(x, num, FT, ierr, herr, 255&)
Test = FT
If ierr <> 0 Then Test = "Error, Error, Error"
End Function
Delete