Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running a .bat or .cmd file from VBA ? 1

Status
Not open for further replies.

pradipto

Programmer
Joined
Apr 29, 2002
Messages
22
Location
US
How can you run a .bat or .cmd file from VBA ? The Shell command can only .exe files and not .cmd or .bat files.

Please help.
 
Here is a URL to a tek-tips thread. PHV suggested a solution in it.


Cmd = """C:\Documents and Settings\Paul\My Documents\My Bits & Pieces\C_Dir.bat"""
Set sh = CreateObject("WScript.Shell")
RC = sh.Run(Cmd, 1, True)
 
Thanks Zygor. I had the same problem mentioned in the post. Need to put that """ (triple quotes).

Regards.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top