Via VBA, I am trying to run an executable that has parameters and a file name.
Dim strProgramName As String
Dim strArgument0 As String
Dim strArgument1 As String
'//This is the executable
strProgramName = "C:\Dir0\Dir1\Dir2\Dir3\MyExecutable.exe"
'//These are the required parameters
strArgument0 = " /x /y "
'//This is file to process
strArgument1 = "C:\Dir0\Dir1\Dir2\Dir3\Dir4\Dir5\MyFile.TXT"
Dim LValue As String
LValue = """" & strProgramName & """ """ & strArgument0 & """ """ & strArgument1 & """"
Call Shell(LValue, vbNormalFocus)
This call works through windows command line and I am trying to get it to work when hitting a VBA button.
Command Line is something like this: " "C:\Dir0\Dir1\Dir2\Dir3\MyExecutable.exe /x /y "C:\Dir0\Dir1\Dir2\Dir3\Dir4\Dir5\MyFile.TXT" "
When the button is hit, this function is called that has Call Shell(LValue, vbNormalFocus)...but I get errors...the errors are relative to the executable with arguments and file so I think it's an escape, slash, file name type error
Any help is appreciated.
Dim strProgramName As String
Dim strArgument0 As String
Dim strArgument1 As String
'//This is the executable
strProgramName = "C:\Dir0\Dir1\Dir2\Dir3\MyExecutable.exe"
'//These are the required parameters
strArgument0 = " /x /y "
'//This is file to process
strArgument1 = "C:\Dir0\Dir1\Dir2\Dir3\Dir4\Dir5\MyFile.TXT"
Dim LValue As String
LValue = """" & strProgramName & """ """ & strArgument0 & """ """ & strArgument1 & """"
Call Shell(LValue, vbNormalFocus)
This call works through windows command line and I am trying to get it to work when hitting a VBA button.
Command Line is something like this: " "C:\Dir0\Dir1\Dir2\Dir3\MyExecutable.exe /x /y "C:\Dir0\Dir1\Dir2\Dir3\Dir4\Dir5\MyFile.TXT" "
When the button is hit, this function is called that has Call Shell(LValue, vbNormalFocus)...but I get errors...the errors are relative to the executable with arguments and file so I think it's an escape, slash, file name type error
Any help is appreciated.
Last edited: