ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Shell Command Fails (sometimes) (https://www.excelbanter.com/excel-programming/404572-shell-command-fails-sometimes.html)

Daniel

Shell Command Fails (sometimes)
 
I have been using the shell command often this way:

Shell Environ("comspec") & " /c " & ProgramFile & " <" & InFile & " " &
OutFile, vbNormalFocus

Sometimes it works and sometimes it does not (within the same directory, the
path is OK.) It does not seem to be reading the input file of the executable.

any ideas?

Thanks
Dan

Rick Rothstein \(MVP - VB\)

Shell Command Fails (sometimes)
 
Is it failing when the filename or its path contains blank spaces in them?
Try this...

Shell Environ("comspec") & " /c """ & ProgramFile & _
""" <""" & InFile & _
""" """ & OutFile & """", vbNormalFocus

Rick


"Daniel" wrote in message
...
I have been using the shell command often this way:

Shell Environ("comspec") & " /c " & ProgramFile & " <" & InFile & " " &
OutFile, vbNormalFocus

Sometimes it works and sometimes it does not (within the same directory,
the
path is OK.) It does not seem to be reading the input file of the
executable.

any ideas?

Thanks
Dan



Daniel

Shell Command Fails (sometimes)
 
Thx Rick, but it still does the same
any other ideas?



"Rick Rothstein (MVP - VB)" wrote:

Is it failing when the filename or its path contains blank spaces in them?
Try this...

Shell Environ("comspec") & " /c """ & ProgramFile & _
""" <""" & InFile & _
""" """ & OutFile & """", vbNormalFocus

Rick


"Daniel" wrote in message
...
I have been using the shell command often this way:

Shell Environ("comspec") & " /c " & ProgramFile & " <" & InFile & " " &
OutFile, vbNormalFocus

Sometimes it works and sometimes it does not (within the same directory,
the
path is OK.) It does not seem to be reading the input file of the
executable.

any ideas?

Thanks
Dan




Rick Rothstein \(MVP - VB\)

Shell Command Fails (sometimes)
 
When you say it doesn't work... what does that mean? When it doesn't work,
do you get any kind of indication that it didn't work? Do you get an error
(if so, what is the error message)? Does something happen, but not what you
expect? Does nothing happen?

Oh, I have to ask... you are use paths with your filenames, right?

Rick


"Daniel" wrote in message
...
Thx Rick, but it still does the same
any other ideas?



"Rick Rothstein (MVP - VB)" wrote:

Is it failing when the filename or its path contains blank spaces in
them?
Try this...

Shell Environ("comspec") & " /c """ & ProgramFile & _
""" <""" & InFile & _
""" """ & OutFile & """", vbNormalFocus

Rick


"Daniel" wrote in message
...
I have been using the shell command often this way:

Shell Environ("comspec") & " /c " & ProgramFile & " <" & InFile & " "
&
OutFile, vbNormalFocus

Sometimes it works and sometimes it does not (within the same
directory,
the
path is OK.) It does not seem to be reading the input file of the
executable.

any ideas?

Thanks
Dan





Daniel

Shell Command Fails (sometimes)
 
Q1)When you say it doesn't work... what does that mean?
A1) The desired results does not happen, the exe is not executed

Q2) When it doesn't work, do you get any kind of indication that it didn't
work?
A2) yes, the dos screen flashes (open/close) however the exe is not
executed, no error message to work with, no error message in the output file
(when the exe runs it generates an out file), this means the exe did not kick
in, why, that is what I am trying to find out

and the problem is that this is intermittent, sometimes it works and
sometimes it does not,

sorry I am really disconcerted with this
any other ideas








"Rick Rothstein (MVP - VB)" wrote:

When you say it doesn't work... what does that mean? When it doesn't work,
do you get any kind of indication that it didn't work? Do you get an error
(if so, what is the error message)? Does something happen, but not what you
expect? Does nothing happen?

Oh, I have to ask... you are use paths with your filenames, right?

Rick


"Daniel" wrote in message
...
Thx Rick, but it still does the same
any other ideas?



"Rick Rothstein (MVP - VB)" wrote:

Is it failing when the filename or its path contains blank spaces in
them?
Try this...

Shell Environ("comspec") & " /c """ & ProgramFile & _
""" <""" & InFile & _
""" """ & OutFile & """", vbNormalFocus

Rick


"Daniel" wrote in message
...
I have been using the shell command often this way:

Shell Environ("comspec") & " /c " & ProgramFile & " <" & InFile & " "
&
OutFile, vbNormalFocus

Sometimes it works and sometimes it does not (within the same
directory,
the
path is OK.) It does not seem to be reading the input file of the
executable.

any ideas?

Thanks
Dan






All times are GMT +1. The time now is 04:47 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com