Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default dll call in Excel 2007

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to call a COM add-in function from macro in Excel 2007 Sink0 Excel Discussion (Misc queries) 1 January 11th 10 06:47 AM
Excel 2007 Charts and Call Outs Marilyn Excel Discussion (Misc queries) 2 April 9th 09 07:07 PM
Excel 2007 VB function call return value syntax question pop tufty Excel Programming 1 January 19th 08 04:50 PM
How to call a soap web service in excel 2007 Benjamin Janecke Excel Programming 0 July 18th 07 02:04 PM
Can you call a Web Service from Excel 2007 without writing code? BigBadBubba Excel Discussion (Misc queries) 0 March 14th 07 03:32 AM


All times are GMT +1. The time now is 10:18 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"