You could make your own function that takes a paramArray of shell commands and loops through, executing the shell command on each. Like this:
Sub ExecuteShell(ParamArray arg() As Variant)
Dim element As Variant
For Each element In arg
Call Shell(element)
Next element
End Sub
Of course, you'll want to maybe trap for "bad" shell arguments.
You would run the above like this:
Sub Test()
Dim arg1, arg2, arg3 As String
arg1 = "filepath1..."
arg2 = "filepath2..."
arg3 = "filepath3..."
Call ExecuteShell(arg1, arg2, arg3)
End Sub
Alternatively, you could structure the function to accept a filepath argument and an array of arguments then all get concatenated together into a single command, like this:
Sub ExecuteShell(path As String, ParamArray arg() As Variant)
Dim element As Variant
Dim cmd As String
cmd = path & " " 'insert any pre-arguments charaters
For Each element In arg
cmd = cmd & element & ", "
Next element
'remove last comma
cmd = Left(cmd, Len(cmd) - 2)
Call Shell(cmd)
End Sub
"
instances... can I separate all my arguments with"
- YES I can is the answer to that. Now all I need to know is if this stupid question has been asked before. Sure it has.Shell
command on them.[ComVisible]
.