Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to call a COM add-in function from macro in Excel 2007 | Excel Discussion (Misc queries) | |||
Excel 2007 Charts and Call Outs | Excel Discussion (Misc queries) | |||
Excel 2007 VB function call return value syntax question | Excel Programming | |||
How to call a soap web service in excel 2007 | Excel Programming | |||
Can you call a Web Service from Excel 2007 without writing code? | Excel Discussion (Misc queries) |