Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Reh Reh is offline
external usenet poster
 
Posts: 4
Default Problems running a dos program from vba script

Hello all, I'm new to the group so I hope this isn't too redundant of a

question.
I'm encountering a problem when attempting to call an external program
from an Excel macro. The macro runs through a variety of formatting
routines and then saves the file in .prn format to pass to the dos
program (this program generates a fish population estimate and is
unfortunately, to complex to simply write within the code.) I'm at the
point where I need to call up the program. I used the shell procedure
to access the dos program .exe file. It does access the program (I can
see the start screen flash) but then closes out. I tried writing a
batch file and accessing that from the macro..same result. The only
time I could get it to work, is when the batch file was misdirected
(another story) and had to search for the execution file. It found the
file (or rather a copy of it in another directory) and things worked
fine from there. Any thoughts?
thanks in advance..
-Chris.

note: I posted this in the excel vba group as well, but that group
seems to have low activity,
my appoligies for any inconvience caused by the crossposting.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 249
Default Problems running a dos program from vba script

Can you post your code?

--

Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

"Reh" wrote:
Hello all, I'm new to the group so I hope this isn't too redundant of a

question.
I'm encountering a problem when attempting to call an external program
from an Excel macro. The macro runs through a variety of formatting
routines and then saves the file in .prn format to pass to the dos
program (this program generates a fish population estimate and is
unfortunately, to complex to simply write within the code.) I'm at the
point where I need to call up the program. I used the shell procedure
to access the dos program .exe file. It does access the program (I can
see the start screen flash) but then closes out. I tried writing a
batch file and accessing that from the macro..same result. The only
time I could get it to work, is when the batch file was misdirected
(another story) and had to search for the execution file. It found the
file (or rather a copy of it in another directory) and things worked
fine from there. Any thoughts?
thanks in advance..
-Chris.

note: I posted this in the excel vba group as well, but that group
seems to have low activity,
my appoligies for any inconvience caused by the crossposting.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 284
Default Problems running a dos program from vba script

Chris

As Dave suggests, it would help to see your code.

I suspect that you may only need to insert the "/k" switch after the
"cmd.exe", "command.com" or "%comspec%" and before the name of your
executable dos file in the line where you use Shell to launch the dos
program.

Steve


"Reh" wrote in message
oups.com...
Hello all, I'm new to the group so I hope this isn't too redundant of a

question.
I'm encountering a problem when attempting to call an external program
from an Excel macro. The macro runs through a variety of formatting
routines and then saves the file in .prn format to pass to the dos
program (this program generates a fish population estimate and is
unfortunately, to complex to simply write within the code.) I'm at the
point where I need to call up the program. I used the shell procedure
to access the dos program .exe file. It does access the program (I can
see the start screen flash) but then closes out. I tried writing a
batch file and accessing that from the macro..same result. The only
time I could get it to work, is when the batch file was misdirected
(another story) and had to search for the execution file. It found the
file (or rather a copy of it in another directory) and things worked
fine from there. Any thoughts?
thanks in advance..
-Chris.

note: I posted this in the excel vba group as well, but that group
seems to have low activity,
my appoligies for any inconvience caused by the crossposting.



  #4   Report Post  
Posted to microsoft.public.excel.programming
Reh Reh is offline
external usenet poster
 
Posts: 4
Default Problems running a dos program from vba script

Thanks guys,
The code is at work, and I'm afraid I can't remember it off the top of
my head.
I'll post it first thing in the morning.
-Chris

Steve Yandl wrote:
Chris

As Dave suggests, it would help to see your code.

I suspect that you may only need to insert the "/k" switch after the
"cmd.exe", "command.com" or "%comspec%" and before the name of your
executable dos file in the line where you use Shell to launch the dos
program.

Steve


"Reh" wrote in message
oups.com...
Hello all, I'm new to the group so I hope this isn't too redundant of a

question.
I'm encountering a problem when attempting to call an external program
from an Excel macro. The macro runs through a variety of formatting
routines and then saves the file in .prn format to pass to the dos
program (this program generates a fish population estimate and is
unfortunately, to complex to simply write within the code.) I'm at the
point where I need to call up the program. I used the shell procedure
to access the dos program .exe file. It does access the program (I can
see the start screen flash) but then closes out. I tried writing a
batch file and accessing that from the macro..same result. The only
time I could get it to work, is when the batch file was misdirected
(another story) and had to search for the execution file. It found the
file (or rather a copy of it in another directory) and things worked
fine from there. Any thoughts?
thanks in advance..
-Chris.

note: I posted this in the excel vba group as well, but that group
seems to have low activity,
my appoligies for any inconvience caused by the crossposting.


  #5   Report Post  
Posted to microsoft.public.excel.programming
Reh Reh is offline
external usenet poster
 
Posts: 4
Default Problems running a dos program from vba script

Okay,
So my memory is really bad, but what I've done is just used the shell
command.

first I simply tried to access the execution file:
Shell("C:\Microfish\mfish-db.exe", 1)

when that wasn't working I tried using a batch file:
Shell("C:\Microfish\gofish.bat", 1)

my last attempt was this:
Call Shell("C:\Microfish\gofish.bat", vbNormalFocus)

I'm sure this is basic. I'm learning as I go.
Thanks much,
-Chris.

Reh wrote:
Thanks guys,
The code is at work, and I'm afraid I can't remember it off the top of
my head.
I'll post it first thing in the morning.
-Chris

Steve Yandl wrote:
Chris

As Dave suggests, it would help to see your code.

I suspect that you may only need to insert the "/k" switch after the
"cmd.exe", "command.com" or "%comspec%" and before the name of your
executable dos file in the line where you use Shell to launch the dos
program.

Steve


"Reh" wrote in message
oups.com...
Hello all, I'm new to the group so I hope this isn't too redundant of a

question.
I'm encountering a problem when attempting to call an external program
from an Excel macro. The macro runs through a variety of formatting
routines and then saves the file in .prn format to pass to the dos
program (this program generates a fish population estimate and is
unfortunately, to complex to simply write within the code.) I'm at the
point where I need to call up the program. I used the shell procedure
to access the dos program .exe file. It does access the program (I can
see the start screen flash) but then closes out. I tried writing a
batch file and accessing that from the macro..same result. The only
time I could get it to work, is when the batch file was misdirected
(another story) and had to search for the execution file. It found the
file (or rather a copy of it in another directory) and things worked
fine from there. Any thoughts?
thanks in advance..
-Chris.

note: I posted this in the excel vba group as well, but that group
seems to have low activity,
my appoligies for any inconvience caused by the crossposting.




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 249
Default Problems running a dos program from vba script

Might be this is what you're looking for.

http://www.vb-helper.com/howto_shell_wait.html

--

Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

"Reh" wrote:
Okay,
So my memory is really bad, but what I've done is just used the shell
command.

first I simply tried to access the execution file:
Shell("C:\Microfish\mfish-db.exe", 1)

when that wasn't working I tried using a batch file:
Shell("C:\Microfish\gofish.bat", 1)

my last attempt was this:
Call Shell("C:\Microfish\gofish.bat", vbNormalFocus)

I'm sure this is basic. I'm learning as I go.
Thanks much,
-Chris.

Reh wrote:
Thanks guys,
The code is at work, and I'm afraid I can't remember it off the top of
my head.
I'll post it first thing in the morning.
-Chris

Steve Yandl wrote:
Chris

As Dave suggests, it would help to see your code.

I suspect that you may only need to insert the "/k" switch after the
"cmd.exe", "command.com" or "%comspec%" and before the name of your
executable dos file in the line where you use Shell to launch the dos
program.

Steve


"Reh" wrote in message
oups.com...
Hello all, I'm new to the group so I hope this isn't too redundant of
a

question.
I'm encountering a problem when attempting to call an external
program
from an Excel macro. The macro runs through a variety of formatting
routines and then saves the file in .prn format to pass to the dos
program (this program generates a fish population estimate and is
unfortunately, to complex to simply write within the code.) I'm at
the
point where I need to call up the program. I used the shell procedure
to access the dos program .exe file. It does access the program (I
can
see the start screen flash) but then closes out. I tried writing a
batch file and accessing that from the macro..same result. The only
time I could get it to work, is when the batch file was misdirected
(another story) and had to search for the execution file. It found
the
file (or rather a copy of it in another directory) and things worked
fine from there. Any thoughts?
thanks in advance..
-Chris.

note: I posted this in the excel vba group as well, but that group
seems to have low activity,
my appoligies for any inconvience caused by the crossposting.



  #7   Report Post  
Posted to microsoft.public.excel.programming
Reh Reh is offline
external usenet poster
 
Posts: 4
Default Problems running a dos program from vba script

That did the trick Dave. Thanks much.



Dave Patrick wrote:
Might be this is what you're looking for.

http://www.vb-helper.com/howto_shell_wait.html

--

Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

"Reh" wrote:
Okay,
So my memory is really bad, but what I've done is just used the shell
command.

first I simply tried to access the execution file:
Shell("C:\Microfish\mfish-db.exe", 1)

when that wasn't working I tried using a batch file:
Shell("C:\Microfish\gofish.bat", 1)

my last attempt was this:
Call Shell("C:\Microfish\gofish.bat", vbNormalFocus)

I'm sure this is basic. I'm learning as I go.
Thanks much,
-Chris.

Reh wrote:
Thanks guys,
The code is at work, and I'm afraid I can't remember it off the top of
my head.
I'll post it first thing in the morning.
-Chris

Steve Yandl wrote:
Chris

As Dave suggests, it would help to see your code.

I suspect that you may only need to insert the "/k" switch after the
"cmd.exe", "command.com" or "%comspec%" and before the name of your
executable dos file in the line where you use Shell to launch the dos
program.

Steve


"Reh" wrote in message
oups.com...
Hello all, I'm new to the group so I hope this isn't too redundant of
a

question.
I'm encountering a problem when attempting to call an external
program
from an Excel macro. The macro runs through a variety of formatting
routines and then saves the file in .prn format to pass to the dos
program (this program generates a fish population estimate and is
unfortunately, to complex to simply write within the code.) I'm at
the
point where I need to call up the program. I used the shell procedure
to access the dos program .exe file. It does access the program (I
can
see the start screen flash) but then closes out. I tried writing a
batch file and accessing that from the macro..same result. The only
time I could get it to work, is when the batch file was misdirected
(another story) and had to search for the execution file. It found
the
file (or rather a copy of it in another directory) and things worked
fine from there. Any thoughts?
thanks in advance..
-Chris.

note: I posted this in the excel vba group as well, but that group
seems to have low activity,
my appoligies for any inconvience caused by the crossposting.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
script to launch a program from excel calvin Excel Discussion (Misc queries) 4 January 29th 09 09:12 PM
running script when workbook opens problems rich Excel Programming 0 November 3rd 06 08:05 PM
I have a kind of complex macro or vb script I want to program but do not know? bjwoodruff Excel Programming 4 June 14th 05 10:35 PM
how do i program a vb script in excel to tell me which cell has f. ragnarok Excel Programming 1 April 5th 05 06:27 PM
running vbs script from vba? John Gunn Excel Programming 1 November 13th 04 01:08 AM


All times are GMT +1. The time now is 01:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"