Shell statement

  • Thread starter Thread starter Eric
  • Start date Start date
E

Eric

My shell statement target path is not interpretting the
folder name "Test Reports" correctly with the space
between Test and Reports. It interprets the application
path fine. What should I do and why?

Dim RetVal
Dim strPath,strFileName
strFileName = Left$(strCustomer,6) & strRptDate
strPath = "C:\Program Files\Microsoft
Office\Office\excel.exe M:\Test Reports\" & strFileName
& ".xls"
RetVal = Shell(strPath, 1)
 
Eric said:
My shell statement target path is not interpretting the
folder name "Test Reports" correctly with the space
between Test and Reports. It interprets the application
path fine. What should I do and why?

Dim RetVal
Dim strPath,strFileName
strFileName = Left$(strCustomer,6) & strRptDate
strPath = "C:\Program Files\Microsoft
Office\Office\excel.exe M:\Test Reports\" & strFileName
& ".xls"
RetVal = Shell(strPath, 1)

Try this:

strPath = _
"C:\Program Files\Microsoft Office\Office\excel.exe " & _
Chr(34) & "M:\Test Reports\" & strFileName & ".xls" & Chr(34)
 
Back
Top