The Shell Command allows you to open up and run files on your computer, In this example we use it to run a batch file.
Download the samples for this series for free!
All our tutorial samples are free however if you appreciate our work and would like to make a voluntary donation then please do.
Recommended Reading
Both the below books by John Walkenbach are fantastic books and he is a brilliant author, I would recommend picking one of these books up even if just for a reference. I have read power programming cover to cover and it is easy to follow and is a must have for any serious VBA programmer.
If you have read any books and feel they are worth recommending then please post about them on our Forum.
Hi Matt, when I try to pass the parameter %1, the Shell window no longer stays open on the screen. It flashes up and disappears very fast. Everything I have done is like for like. Any ideas as why this could be happening?
Thanks
Sean (casey67)
Have you got the PAUSE Batch command at the end of your batch code. Otherwise it will just run and then close?
Yeah got the pause command at the end of code. Tried deleting and then adding back but it’s still not having any of it.
Any other suggestions?
…I am trying all these on VBA 2007 and a laptop running Vista Basic. Would this affect it perhaps?
do you want to paste your batch code in the comments so I can run it myself?
Its the same code as yours Matt:
echo %1
pause