ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Shell Out Failing (https://www.excelbanter.com/excel-programming/405009-shell-out-failing.html)

mburkett

Shell Out Failing
 
I initially wrote the macro below with manual wait times to slow it
down so the shell outs would work. I ran across some code on Microsoft
knowledge base that checks for a files existence before continuing
because the wait times worked on some machines and not others because
of network speeds. The macro works fine on the first shell out but
never runs the second one. I know the code works because if I step
throught it manually everything happens as planned. I pasted the a
section of the code below. Here are the 2 lines in question:
It runs this line: progID = Shell("f:\axys3\rep32.exe -mqtr_eoy -p" &
ccm & " -u -s -vP -t" & filesavename)
Fails to run this line: progID = Shell("f:\axys3\rep32.exe -mperf -
p" & ccm & " -u -s -vx -t" & filesavename)

Section of code in question (MY NOTES ARE IN ALL CAPS):
progID = Shell("f:\axys3\rep32.exe -mqtr_eoy -p" & ccm & " -u -s -vP -
t" & filesavename)
FindIt = Dir("f:\axys3\rmf\" + filesavename + ".rmf")
While Len(FindIt) = 0
FindIt = Dir("f:\axys3\rmf\" + filesavename + ".rmf")
Wend


progID = Shell("command.com /Ccopy f:\axys3\rmf\" + filesavename +
".rmf f:\perf\reports\" + perffolder)

FindIt2 = Dir("f:\axys3\txt\" + filesavename + ".TXT")
If Not Len(FindIt2) = 0 Then
Kill "f:\axys3\txt\" + filesavename + ".TXT"
End If

progID = Shell("f:\axys3\rep32.exe -mperf -p" & ccm & " -u -s -vx -
t" & filesavename)
'THE LINE ABOVE NEVER RUNS SO THE FIND FILE CODE BOMBS OUT BELOW

FindIt2 = Dir("f:\axys3\txt\" + filesavename + ".TXT")
While Len(FindIt2) = 0
FindIt2 = Dir("f:\axys3\txt\" + filesavename + ".TXT")
Wend

'IT HANGS ON THE CODE ABOVE BECAUSE THE SHELL OUT NEVER RUNS

Jim Cone

Shell Out Failing
 

Are you killing the Flag.txt file between calls to the Shell statement?
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)

"mburkett"
wrote in message
I initially wrote the macro below with manual wait times to slow it
down so the shell outs would work. I ran across some code on Microsoft
knowledge base that checks for a files existence before continuing
because the wait times worked on some machines and not others because
of network speeds. The macro works fine on the first shell out but
never runs the second one. I know the code works because if I step
throught it manually everything happens as planned. I pasted the a
section of the code below. Here are the 2 lines in question:
It runs this line: progID = Shell("f:\axys3\rep32.exe -mqtr_eoy -p" &
ccm & " -u -s -vP -t" & filesavename)
Fails to run this line: progID = Shell("f:\axys3\rep32.exe -mperf -
p" & ccm & " -u -s -vx -t" & filesavename)

Section of code in question (MY NOTES ARE IN ALL CAPS):
progID = Shell("f:\axys3\rep32.exe -mqtr_eoy -p" & ccm & " -u -s -vP -
t" & filesavename)
FindIt = Dir("f:\axys3\rmf\" + filesavename + ".rmf")
While Len(FindIt) = 0
FindIt = Dir("f:\axys3\rmf\" + filesavename + ".rmf")
Wend


progID = Shell("command.com /Ccopy f:\axys3\rmf\" + filesavename +
".rmf f:\perf\reports\" + perffolder)

FindIt2 = Dir("f:\axys3\txt\" + filesavename + ".TXT")
If Not Len(FindIt2) = 0 Then
Kill "f:\axys3\txt\" + filesavename + ".TXT"
End If

progID = Shell("f:\axys3\rep32.exe -mperf -p" & ccm & " -u -s -vx -
t" & filesavename)
'THE LINE ABOVE NEVER RUNS SO THE FIND FILE CODE BOMBS OUT BELOW

FindIt2 = Dir("f:\axys3\txt\" + filesavename + ".TXT")
While Len(FindIt2) = 0
FindIt2 = Dir("f:\axys3\txt\" + filesavename + ".TXT")
Wend

'IT HANGS ON THE CODE ABOVE BECAUSE THE SHELL OUT NEVER RUNS

mburkett

Shell Out Failing
 
On Jan 25, 12:15*pm, "Jim Cone" wrote:
Are you killing the Flag.txt file between calls to the Shell statement?
--
Jim Cone
San Francisco, USAhttp://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)

"mburkett"
wrote in message
I initially wrote the macro below with manual wait times to slow it
down so the shell outs would work. I ran across some code on Microsoft
knowledge base that checks for a files existence before continuing
because the wait times worked on some machines and not others because
of network speeds. The macro works fine on the first shell out but
never runs the second one. I know the code works because if I step
throught it manually everything happens as planned. I pasted the a
section of the code below. Here are the 2 lines in question:
It runs this line: progID = Shell("f:\axys3\rep32.exe -mqtr_eoy -p" &
ccm & " -u -s -vP -t" & filesavename)
Fails to run this line: progID = Shell("f:\axys3\rep32.exe *-mperf *-
p" & ccm & " -u -s -vx -t" & filesavename)

Section of code in question (MY NOTES ARE IN ALL CAPS):
progID = Shell("f:\axys3\rep32.exe -mqtr_eoy -p" & ccm & " -u -s -vP -
t" & filesavename)
FindIt = Dir("f:\axys3\rmf\" + filesavename + ".rmf")
While Len(FindIt) = 0
FindIt = Dir("f:\axys3\rmf\" + filesavename + ".rmf")
Wend

progID = Shell("command.com /Ccopy f:\axys3\rmf\" + filesavename +
".rmf f:\perf\reports\" + perffolder)

FindIt2 = Dir("f:\axys3\txt\" + filesavename + ".TXT")
If Not Len(FindIt2) = 0 Then
Kill "f:\axys3\txt\" + filesavename + ".TXT"
End If

progID = Shell("f:\axys3\rep32.exe *-mperf *-p" & ccm & " -u -s -vx -
t" & filesavename)
'THE LINE ABOVE NEVER RUNS SO THE FIND FILE CODE BOMBS OUT BELOW

FindIt2 = Dir("f:\axys3\txt\" + filesavename + ".TXT")
While Len(FindIt2) = 0
FindIt2 = Dir("f:\axys3\txt\" + filesavename + ".TXT")
Wend

'IT HANGS ON THE CODE ABOVE BECAUSE THE SHELL OUT NEVER RUNS


Yes. Do you think that is causing an issue?

Jim Cone

Shell Out Failing
 

I thought you were Not killing the Flag file, so I don't know what the issue is.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)



"mburkett"
wrote in message
Yes. Do you think that is causing an issue?
-snip-


On Jan 25, 12:15 pm, "Jim Cone"
wrote:
Are you killing the Flag.txt file between calls to the Shell statement?



Tim Williams

Shell Out Failing
 
Have you tried echoing your shell lines via debug.print and running them
manually ?

Tim


"mburkett" wrote in message
...
I initially wrote the macro below with manual wait times to slow it
down so the shell outs would work. I ran across some code on Microsoft
knowledge base that checks for a files existence before continuing
because the wait times worked on some machines and not others because
of network speeds. The macro works fine on the first shell out but
never runs the second one. I know the code works because if I step
throught it manually everything happens as planned. I pasted the a
section of the code below. Here are the 2 lines in question:
It runs this line: progID = Shell("f:\axys3\rep32.exe -mqtr_eoy -p" &
ccm & " -u -s -vP -t" & filesavename)
Fails to run this line: progID = Shell("f:\axys3\rep32.exe -mperf -
p" & ccm & " -u -s -vx -t" & filesavename)

Section of code in question (MY NOTES ARE IN ALL CAPS):
progID = Shell("f:\axys3\rep32.exe -mqtr_eoy -p" & ccm & " -u -s -vP -
t" & filesavename)
FindIt = Dir("f:\axys3\rmf\" + filesavename + ".rmf")
While Len(FindIt) = 0
FindIt = Dir("f:\axys3\rmf\" + filesavename + ".rmf")
Wend


progID = Shell("command.com /Ccopy f:\axys3\rmf\" + filesavename +
".rmf f:\perf\reports\" + perffolder)

FindIt2 = Dir("f:\axys3\txt\" + filesavename + ".TXT")
If Not Len(FindIt2) = 0 Then
Kill "f:\axys3\txt\" + filesavename + ".TXT"
End If

progID = Shell("f:\axys3\rep32.exe -mperf -p" & ccm & " -u -s -vx -
t" & filesavename)
'THE LINE ABOVE NEVER RUNS SO THE FIND FILE CODE BOMBS OUT BELOW

FindIt2 = Dir("f:\axys3\txt\" + filesavename + ".TXT")
While Len(FindIt2) = 0
FindIt2 = Dir("f:\axys3\txt\" + filesavename + ".TXT")
Wend

'IT HANGS ON THE CODE ABOVE BECAUSE THE SHELL OUT NEVER RUNS




mburkett

Shell Out Failing
 
On Jan 25, 11:58*pm, "Tim Williams" <timjwilliams at gmail dot com
wrote:
Have you tried echoing your shell lines via debug.print and running them
manually ?

Tim

"mburkett" wrote in message

...



I initially wrote the macro below with manual wait times to slow it
down so the shell outs would work. I ran across some code on Microsoft
knowledge base that checks for a files existence before continuing
because the wait times worked on some machines and not others because
of network speeds. The macro works fine on the first shell out but
never runs the second one. I know the code works because if I step
throught it manually everything happens as planned. I pasted the a
section of the code below. Here are the 2 lines in question:
It runs this line: progID = Shell("f:\axys3\rep32.exe -mqtr_eoy -p" &
ccm & " -u -s -vP -t" & filesavename)
Fails to run this line: progID = Shell("f:\axys3\rep32.exe *-mperf *-
p" & ccm & " -u -s -vx -t" & filesavename)


Section of code in question (MY NOTES ARE IN ALL CAPS):
progID = Shell("f:\axys3\rep32.exe -mqtr_eoy -p" & ccm & " -u -s -vP -
t" & filesavename)
FindIt = Dir("f:\axys3\rmf\" + filesavename + ".rmf")
While Len(FindIt) = 0
FindIt = Dir("f:\axys3\rmf\" + filesavename + ".rmf")
Wend


progID = Shell("command.com /Ccopy f:\axys3\rmf\" + filesavename +
".rmf f:\perf\reports\" + perffolder)


FindIt2 = Dir("f:\axys3\txt\" + filesavename + ".TXT")
If Not Len(FindIt2) = 0 Then
Kill "f:\axys3\txt\" + filesavename + ".TXT"
End If


progID = Shell("f:\axys3\rep32.exe *-mperf *-p" & ccm & " -u -s -vx -
t" & filesavename)
'THE LINE ABOVE NEVER RUNS SO THE FIND FILE CODE BOMBS OUT BELOW


FindIt2 = Dir("f:\axys3\txt\" + filesavename + ".TXT")
While Len(FindIt2) = 0
FindIt2 = Dir("f:\axys3\txt\" + filesavename + ".TXT")
Wend


'IT HANGS ON THE CODE ABOVE BECAUSE THE SHELL OUT NEVER RUNS- Hide quoted text -


- Show quoted text -


I am not sure how to do that?

Tim Williams

Shell Out Failing
 
Debug.Print "f:\axys3\rep32.exe -mperf -p" & ccm & " -u -s -vx -t" &
filesavename

Then run the string that gets printed.

Or switch to using the wscript shell.exec method, which gives to access to
stderr and stdout.
http://msdn2.microsoft.com/en-us/lib...4a(VS.85).aspx

Tim


"mburkett" wrote in message
...
On Jan 25, 11:58 pm, "Tim Williams" <timjwilliams at gmail dot com
wrote:
Have you tried echoing your shell lines via debug.print and running them
manually ?

Tim

"mburkett" wrote in message

...



I initially wrote the macro below with manual wait times to slow it
down so the shell outs would work. I ran across some code on Microsoft
knowledge base that checks for a files existence before continuing
because the wait times worked on some machines and not others because
of network speeds. The macro works fine on the first shell out but
never runs the second one. I know the code works because if I step
throught it manually everything happens as planned. I pasted the a
section of the code below. Here are the 2 lines in question:
It runs this line: progID = Shell("f:\axys3\rep32.exe -mqtr_eoy -p" &
ccm & " -u -s -vP -t" & filesavename)
Fails to run this line: progID = Shell("f:\axys3\rep32.exe -mperf -
p" & ccm & " -u -s -vx -t" & filesavename)


Section of code in question (MY NOTES ARE IN ALL CAPS):
progID = Shell("f:\axys3\rep32.exe -mqtr_eoy -p" & ccm & " -u -s -vP -
t" & filesavename)
FindIt = Dir("f:\axys3\rmf\" + filesavename + ".rmf")
While Len(FindIt) = 0
FindIt = Dir("f:\axys3\rmf\" + filesavename + ".rmf")
Wend


progID = Shell("command.com /Ccopy f:\axys3\rmf\" + filesavename +
".rmf f:\perf\reports\" + perffolder)


FindIt2 = Dir("f:\axys3\txt\" + filesavename + ".TXT")
If Not Len(FindIt2) = 0 Then
Kill "f:\axys3\txt\" + filesavename + ".TXT"
End If


progID = Shell("f:\axys3\rep32.exe -mperf -p" & ccm & " -u -s -vx -
t" & filesavename)
'THE LINE ABOVE NEVER RUNS SO THE FIND FILE CODE BOMBS OUT BELOW


FindIt2 = Dir("f:\axys3\txt\" + filesavename + ".TXT")
While Len(FindIt2) = 0
FindIt2 = Dir("f:\axys3\txt\" + filesavename + ".TXT")
Wend


'IT HANGS ON THE CODE ABOVE BECAUSE THE SHELL OUT NEVER RUNS- Hide
quoted text -


- Show quoted text -


I am not sure how to do that?




All times are GMT +1. The time now is 11:08 AM.

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