ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Tough One - Return output from Dos Process without writing to file (https://www.excelbanter.com/excel-programming/341444-tough-one-return-output-dos-process-without-writing-file.html)

Andibevan[_4_]

Tough One - Return output from Dos Process without writing to file
 
Hi All,

Does anyone know of an approach that could be used to return the output of a
dos command without having to create a temporary file.

I am currently using the following dos command as part of a "Shell"
command:-

ping localhost temp.txt

I can only find solutions that seem to only work in .net and I need
something for good old VBA

Thanks in advance

Andi



Tom Ogilvy

Tough One - Return output from Dos Process without writing to file
 
http://vbnet.mvps.org/code/internet/ping.htm

--
Regards,
Tom Ogilvy

"Andibevan" wrote in message
...
Hi All,

Does anyone know of an approach that could be used to return the output of

a
dos command without having to create a temporary file.

I am currently using the following dos command as part of a "Shell"
command:-

ping localhost temp.txt

I can only find solutions that seem to only work in .net and I need
something for good old VBA

Thanks in advance

Andi





Andibevan[_4_]

Tough One - Return output from Dos Process without writing to file
 
Tom - thanks for the suggestion but I don't actually want to be able to ping
I actually need to return output from a 3rd party app but thought my example
would be more helpful.

As another example how would I return the information produced by the
command DIR?

"Tom Ogilvy" wrote in message
...
http://vbnet.mvps.org/code/internet/ping.htm

--
Regards,
Tom Ogilvy

"Andibevan" wrote in message
...
Hi All,

Does anyone know of an approach that could be used to return the output

of
a
dos command without having to create a temporary file.

I am currently using the following dos command as part of a "Shell"
command:-

ping localhost temp.txt

I can only find solutions that seem to only work in .net and I need
something for good old VBA

Thanks in advance

Andi







Tom Ogilvy

Tough One - Return output from Dos Process without writing to file
 
If your shelling to the app then I doubt there is a way to get anything back
except perhaps a result code which would most likely be zero.

--
Regards,
Tom Ogilvy


"Andibevan" wrote in message
...
Tom - thanks for the suggestion but I don't actually want to be able to

ping
I actually need to return output from a 3rd party app but thought my

example
would be more helpful.

As another example how would I return the information produced by the
command DIR?

"Tom Ogilvy" wrote in message
...
http://vbnet.mvps.org/code/internet/ping.htm

--
Regards,
Tom Ogilvy

"Andibevan" wrote in message
...
Hi All,

Does anyone know of an approach that could be used to return the

output
of
a
dos command without having to create a temporary file.

I am currently using the following dos command as part of a "Shell"
command:-

ping localhost temp.txt

I can only find solutions that seem to only work in .net and I need
something for good old VBA

Thanks in advance

Andi









John.Greenan

Tough One - Return output from Dos Process without writing to
 
Have a look at this - I think it will help you....

http://msdn.microsoft.com/library/de...ctPropMeth.asp


--
www.alignment-systems.com


"Tom Ogilvy" wrote:

If your shelling to the app then I doubt there is a way to get anything back
except perhaps a result code which would most likely be zero.

--
Regards,
Tom Ogilvy


"Andibevan" wrote in message
...
Tom - thanks for the suggestion but I don't actually want to be able to

ping
I actually need to return output from a 3rd party app but thought my

example
would be more helpful.

As another example how would I return the information produced by the
command DIR?

"Tom Ogilvy" wrote in message
...
http://vbnet.mvps.org/code/internet/ping.htm

--
Regards,
Tom Ogilvy

"Andibevan" wrote in message
...
Hi All,

Does anyone know of an approach that could be used to return the

output
of
a
dos command without having to create a temporary file.

I am currently using the following dos command as part of a "Shell"
command:-

ping localhost temp.txt

I can only find solutions that seem to only work in .net and I need
something for good old VBA

Thanks in advance

Andi










Andibevan[_3_]

Tough One - Return output from Dos Process without writing to
 
Thanks John - That seems to be only for windows script - do you know of any
code that will work in VBA? Or can you use VB script within an excel file?

"John.Greenan" wrote in message
...
Have a look at this - I think it will help you....

http://msdn.microsoft.com/library/de...ctPropMeth.asp


--
www.alignment-systems.com


"Tom Ogilvy" wrote:

If your shelling to the app then I doubt there is a way to get anything
back
except perhaps a result code which would most likely be zero.

--
Regards,
Tom Ogilvy


"Andibevan" wrote in message
...
Tom - thanks for the suggestion but I don't actually want to be able to

ping
I actually need to return output from a 3rd party app but thought my

example
would be more helpful.

As another example how would I return the information produced by the
command DIR?

"Tom Ogilvy" wrote in message
...
http://vbnet.mvps.org/code/internet/ping.htm

--
Regards,
Tom Ogilvy

"Andibevan" wrote in message
...
Hi All,

Does anyone know of an approach that could be used to return the

output
of
a
dos command without having to create a temporary file.

I am currently using the following dos command as part of a "Shell"
command:-

ping localhost temp.txt

I can only find solutions that seem to only work in .net and I need
something for good old VBA

Thanks in advance

Andi












John.Greenan

Tough One - Return output from Dos Process without writing to
 
You can use the windows script within vba. Just reference the windows script
host object model wshom.ocx - should be in the system32 directory.


--
www.alignment-systems.com


"Andibevan" wrote:

Thanks John - That seems to be only for windows script - do you know of any
code that will work in VBA? Or can you use VB script within an excel file?

"John.Greenan" wrote in message
...
Have a look at this - I think it will help you....

http://msdn.microsoft.com/library/de...ctPropMeth.asp


--
www.alignment-systems.com


"Tom Ogilvy" wrote:

If your shelling to the app then I doubt there is a way to get anything
back
except perhaps a result code which would most likely be zero.

--
Regards,
Tom Ogilvy


"Andibevan" wrote in message
...
Tom - thanks for the suggestion but I don't actually want to be able to
ping
I actually need to return output from a 3rd party app but thought my
example
would be more helpful.

As another example how would I return the information produced by the
command DIR?

"Tom Ogilvy" wrote in message
...
http://vbnet.mvps.org/code/internet/ping.htm

--
Regards,
Tom Ogilvy

"Andibevan" wrote in message
...
Hi All,

Does anyone know of an approach that could be used to return the
output
of
a
dos command without having to create a temporary file.

I am currently using the following dos command as part of a "Shell"
command:-

ping localhost temp.txt

I can only find solutions that seem to only work in .net and I need
something for good old VBA

Thanks in advance

Andi














All times are GMT +1. The time now is 10:38 AM.

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