Shell wait and sendkeys

AgathaKare

New Member
Joined
Nov 19, 2013
Messages
1
I need to 1. launch cygwin from VBA, 2. run an executable with inputs and 3. wait for it to finish. I have had success doing steps 1 and 2 OR steps 1 and 3, but cannot figure out all 3.

For steps 1 and 2:
ReturnValue = Shell("C:\cygwin\Cygwin.bat", 1)
SendKeys "S{ENTER}" (this is only one example SendKeys, but I actually have several)

For steps 1 and 3:
Dim wsh As Object
Set wsh = VBA.CreateObject("WScript.Shell")
ReturnValue = wsh.Run("C:\cygwin\Cygwin.bat", "yftedit", windowStyle, waitOnReturn)

For the second bit of code up there, it seems to be waiting for the window to close before going to the next line in VBA (which is my SendKeys to pass the input Cygwin needs to continue).

How can I pass commands to cygwin and wait for the execution to finish?
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop

Forum statistics

Threads
1,215,162
Messages
6,123,382
Members
449,097
Latest member
Jabe

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top