G
Guest
Hi,
I am trying to use the Process object to launch an application (and in some
cases open a file), however whenever there are any spaces in process FileName
or Arguments I get an error stating the file cannot be found. For example:
Dim p As New Process
Dim pi As New ProcessStartInfo
pi.Arguments = "S:\A Folder\Another Folders\My File.xls"
pi.FileName = "Excel.exe"
p.StartInfo = pi
p.Start()
This code causes a 'file not found' error even when the filepath is correct.
I was wondering if I need to substitute the spaces with a difference
character to get this code to work. Any suggestions would be appreciated.
p.s. The example is for Excel, but I may not necessarily be using that
process.
I am trying to use the Process object to launch an application (and in some
cases open a file), however whenever there are any spaces in process FileName
or Arguments I get an error stating the file cannot be found. For example:
Dim p As New Process
Dim pi As New ProcessStartInfo
pi.Arguments = "S:\A Folder\Another Folders\My File.xls"
pi.FileName = "Excel.exe"
p.StartInfo = pi
p.Start()
This code causes a 'file not found' error even when the filepath is correct.
I was wondering if I need to substitute the spaces with a difference
character to get this code to work. Any suggestions would be appreciated.
p.s. The example is for Excel, but I may not necessarily be using that
process.