So, I am looking for a way to execute a batch file with 2 arguments. Arguments are values from a query. Query result has 10-15 rows, so it means that it should iterate through every row, pick up values from those 2 columns, pass them to batch file and execute.
In order to start a batch file, I am unable to use absolute path and shell command. I have managed to start cmd in specific directory (where bat file is located).
Any suggestions?
In order to start a batch file, I am unable to use absolute path and shell command. I have managed to start cmd in specific directory (where bat file is located).
Code:
Private Sub btnBatch_Click()
Dim strProgName As String
Dim strArg As String
Dim strPath As String
strPath = CurrentProject.Path
strProgName = "C:\Windows\System32\cmd.exe"
strArg = "/K cd /d """
Call Shell("""" & strProgName & """""" & strArg & """""" & strPath & """", vbNormalFocus)
Any suggestions?