macro line executes prematurely

S

SueWilson

i have a macro that calls an external program to perform
some functions (creates some files, etc). the next line
in the macro does some processing on those files just
created. problem, line 2 executes before line1 has
finished. how do i control the execution timing so this
doesn't happen.
 
N

Nikos Yannacopoulos

Sue,



To the best of my knowledge, there is no way to make the macro wait until
your external application has finished. To overcome this, you could either:

(a) insert a message box action right after the one that starts the external
application, so the macro is kept waiting, and click OK only when the
ext.app is finished (assuming it runs in avisibnle window, so you know), or

(b) invoke a piece of code that loops checking for the existence of the last
file created, and only proceeds to the next step once it finds it - and with
a date/time stamp that is >=Now(), if you are overwriting an existing file.
Mind you, this only detects the existence of the file reference in the disk
file system, but does not guarantee that the file is fully writen; so, in
case the file is big enough to take more than a flash to create, you will
need additional measures, such as starting a time delay once it's found, or
creating an extra dummy file at the very end of your external app, so you
know all your "real" files are over and done with when the dummy is found.



HTH,

Nikos
 
S

Steve Schapel

Sue,

Are you able to estimate the maximum time taken for the external
program's procedures? If so, you can do something like this...
Split your macro into two macros at the point where the delay happens,
and put an OpenForm action at the end of the first macro, to open a form
which has the second macro on its OnTimer event, and its TimerInterval
property set to the applicable time delay. Make sense?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top