waiting for output of executable using shell command

R

Ryder

Hi all, I am using the shell command to run an executable that in
turns generates an image file which I then want to grab and insert
into a document... using a vba macro.

This all works really well, except that when the time comes to
retrieve the file, it's not there (that is, until the macro ends
execution). I am getting a good return value from the shell command.
The "addpicture" method is failing.

It is not a timing issue. I inserted a 15 second timer to cause the
macro to loop... giving the executable enough time to make the image.
(it does so in under a second).

so for some reason, this scheme seems to be failing due to vba not
allowing the file system to update the contents of the directory... or
something.

Really confused here.

Help!

Thanks!

[begin snippit]

ReturnValue = Shell("c:\Program Files\Image Generator.exe",
1) 'always a good rtn value

[various delay code was tried here, including DoEvents]

If ReturnValue <> 0 Then
ActiveDocument.Shapes(CanvasName).CanvasItems.AddPicture _
FileName:="C:\images\myfile.bmp", _
LinkToFile:=False, SaveWithDocument:=True
end if
 
R

Ryder

BTW, this MAY be related to the operating system. It is working on
Winows XP, but is not working on Windows 2000 Professional.
 

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