vba to loop until process finished

C

chris_culley

Hi,

I'm not so hot on DOS commands so thought I'd better consult!


I'm launching an application from vba then instructing it to run it's
own script as follows:


***


Set oSplus = CreateObject("S-PLUS.Application")
oSplus.executestring ("source(""c:\\" & scriptToRun & """,
echo=T)")


***


The script that the application ( splus) runs takes a looong time at
the end of which S plus closes. I want the launching vba to wait
until
excel closes (i.e, sit in a loop for a while) before continuing in
its own execution.


Not sure how to do this - any pointers would be greatfully
recieved...


Many thanks


Chris
 
N

NickHK

Depends on what this S-Plus exposes.
Does it have a asynchronous/background property that you can set to false ?
Or does it raise any events like ScriptComplete that you can react to ?

NickHK
 
C

chris_culley

Thanks for replying Nick,

Not entirely sure to be honest... I was hoping there would be a way to
get it's dos handle and poll until that disapeared? I think I can do
this if I Shell() the S plus to start it, but don't really want to do
that.

The quick hack is to add to the S plus script to create a file once
its finished then poll on the existance of that file - but that seems
inelegant.

Chris
 
N

NickHK

But as this is an Active component, which you are using COM with, you may as
well check out it available properties.
Use the Object Browser in VBA.

Otherwise, maybe one of the examples of ShellAndWait on the web will do.

NickHK
 

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