Running a .bat windows batch file from excel VBA
I have a file called newcurl.bat
sitting inside the current directory that my excel file is in
I want excelVBA to run this file
I tried:
Shell "cmd.exe /k ""cd " & """ & ThisWorkbook.path & """ & " newcurl.bat"""
but it only CD's to the current folder path but does not physically run the newcurl.bat
file
I ended up figuring it out.
I had a personal.xlsb macrobook so thisworkbook.path
was referencing the wrong workbook.
I ended up doing this instead:
Dim folderPath As String
Dim shellCommand As String
folderPath = Application.ActiveWorkbook.Path
shellCommand = """" & folderPath & "\" & "newcurl.bat" & """"
Call Shell(shellCommand, vbNormalFocus)