Click here to Skip to main content
14,635,966 members
Rate this:
Please Sign up or sign in to vote.
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:
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

Rate this:
Please Sign up or sign in to vote.

Solution 1

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

FYI
Visual Basic for Applications Reference - Shell function[^]
   
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)

  Print Answers RSS
Top Experts
Last 24hrsThis month



CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100