I have code that uses a shell command to run a program. It all works perfect. However, when the command kicks off and the prompt window opens nothing is displayed in the prompt window. Is it possible to have the command that I sent actually be written in the window in stead of just popping up a blank command window? Here is the code:
Private Function RunCaseMngrFiles(ByVal ws As Worksheet, ByVal rng As Range)
Dim caseRng As Range, cl As Range
Set caseRng = rng.Offset(2, 1).CurrentRegion
For Each cl In caseRng
If cl.Value <> "" Then
If CommandLine("C:\RTSimEXE\RTCase.exe " & cl.Value & " batch", vbMinimizedNoFocus) = True Then ws.Cells(cl.Row, cl.Column - 1).Value = "x"
End If
Next cl
End Function
Private Function CommandLine(ByVal xCommand As String, ByVal windowState As VbAppWinStyle) As Boolean
On Error GoTo Err_Hnd
Const strComSpec_c As String = "COMSPEC"
Const strTerminate_c As String = " /c "
Dim strCmdPath As String
Dim strCmdSwtch As String
strCmdPath = VBA.Environ$(strComSpec_c)
strCmdSwtch = strTerminate_c
VBA.Shell strCmdPath & strCmdSwtch & xCommand, windowState
CommandLine = True
Exit Function
On Error GoTo 0
Err_Hnd:
CommandLine = False
End Function
Bookmarks