Apr 8, 2005 #1 pradipto Programmer Apr 29, 2002 22 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.
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.
Apr 8, 2005 1 #2 Zygor Technical User Apr 18, 2001 271 US Here is a URL to a tek-tips thread. PHV suggested a solution in it. http://www.tek-tips.com/viewthread.cfm?qid=932938 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) Upvote 0 Downvote
Here is a URL to a tek-tips thread. PHV suggested a solution in it. http://www.tek-tips.com/viewthread.cfm?qid=932938 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)
Apr 8, 2005 Thread starter #3 pradipto Programmer Apr 29, 2002 22 US Thanks Zygor. I had the same problem mentioned in the post. Need to put that """ (triple quotes). Regards. Upvote 0 Downvote
Thanks Zygor. I had the same problem mentioned in the post. Need to put that """ (triple quotes). Regards.