Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Make VBA wait for return from external function

When a function in a DLL (maybe created with C or Fortran) is called
from VBA, execution of the VBA code continues without waiting for the
called function to return. Is there a way to make VBA wait?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Make VBA wait for return from external function


Gib Bogle;165101 Wrote:
When a function in a DLL (maybe created with C or Fortran) is called
from VBA, execution of the VBA code continues without waiting for the
called function to return. Is there a way to make VBA wait?


Hello Gib,

Your statement "function to return" is ambiguous. To mean return a
value back to VBA, return to VBA when the function has finished running,
or both?

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.thecodecage.com/forumz/member.php?userid=75
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=45830

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Make VBA wait for return from external function

Search this group for "Shell and Wait". There are various approaches, which
will depend on what you are doing overall.

Regards,
Peter T

"Gib Bogle" wrote in message
...
When a function in a DLL (maybe created with C or Fortran) is called from
VBA, execution of the VBA code continues without waiting for the called
function to return. Is there a way to make VBA wait?



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Make VBA wait for return from external function

Peter T wrote:
Search this group for "Shell and Wait". There are various approaches, which
will depend on what you are doing overall.

Regards,
Peter T


I did that, and found only your post.
I would have thought that "Shell" applied to executing an external
process rather than to a call to a DLL routine. Am I wrong?
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Make VBA wait for return from external function

"Gib Bogle" wrote in message
Peter T wrote:
Search this group for "Shell and Wait". There are various approaches,
which will depend on what you are doing overall.


I did that, and found only your post.


So it does, sorry about that, try "ShellAndWait"

I would have thought that "Shell" applied to executing an external process
rather than to a call to a DLL routine. Am I wrong?


Yes you are right and perhaps I misunderstood your situation. Reading your
OP again I don't understand why there is such a problem calling your dll.
Normally when VBA (or an Excel formula) calls a function, even an external
function in a dll, code waits until the function returns its result.

Regards,
Peter T




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Make VBA wait for return from external function

PS
Are you sure there is nothing in the the dll function that leads to
asynchronous behaviour

Regards,
Peter T


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Make VBA wait for return from external function

Peter T wrote:
PS
Are you sure there is nothing in the the dll function that leads to
asynchronous behaviour

Regards,
Peter T



To be honest this is not my problem. A poster asked this question on a
Fortran forum, and my curiosity was provoked. The poster says that
"...Excel 2007 VBA skips over calls [to his Fortran DLL] that take any
time to execute. If I go into debug mode for the VBA and pause after
the call the code completes and the results are passed into Excel."
This doesn't eliminate the possibility that there is something wrong
with the way he handles the returned results when not in debug mode.

Gib
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
60 Second Countdown NOT using the WAIT function... Trevor Williams Excel Programming 18 October 28th 09 05:13 AM
wait function N+ Excel Programming 2 February 10th 08 10:17 PM
Make onTimer wait until Excel finish database request? news.stofanet.dk Excel Programming 2 March 4th 07 08:36 PM
How do I make the true return a drop down list in the IF function? Brian Excel Worksheet Functions 5 April 13th 06 09:40 PM
Web Query Sleep or Wait for return values Sunil_Modi Excel Programming 2 November 19th 04 05:15 PM


All times are GMT +1. The time now is 10:32 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"