Click here to Skip to main content
15,885,757 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
Within excel I run a macro at regular intervals.
I use the following line as part of the macro to run a batch file:
VB
Call Shell(Environ$("COMSPEC") & " /c C:\Temp\autoftp.bat", vbNormalFocus)



All this does is open an ftp connection, call the .dat file to populate the required information, upload and close.

Is there any way of running the batch file without the DOS Shell popping up on the screen to run the file?

It is only there for a second or so but it is annoying and distracting.
Posted

1 solution

Use vbHide instead of vbNormalFocus
So try the below one
VB
Call Shell(Environ$("COMSPEC") & " /c C:\Temp\autoftp.bat", vbHide)

FYI
Visual Basic for Applications Reference - Shell function[^]
 
Share this answer
 
Comments
Dalek Dave 4-Feb-12 14:32pm    
Thanks, that seems to have done it for me!

I owe you, two answers to my dim-witted questions :)
thatraja 5-Feb-12 12:02pm    
Welcome. BTW don't know who down-voted your question. Have my counter.
Espen Harlinn 9-Feb-12 10:00am    
5'ed!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900