PDA

View Full Version : Problem Running Excel From AutoCAD Shell Command


vferrara
2006-02-09, 11:00 PM
Hello to All AUGI Members:

I had a lisp routine that used the shell command to run Excel opening a specified file. The IT department changed tha install path for the Excel.exe file to a location that has spaces in the path such as C:\Program Files\Microsoft Office\Office11\Excel.exe.

Beacuse of the spaces my program will not run Excel with the specified file. Below is a sample of the lisp code that I am using:

#######SAMPLE CODE

(defun c: Dexcel (/ )
(SETVAR "CMDECHO" 0)

;;;This is the old path that worked OK
(command "shell" "P:\\SHARED\\OFFICE\\PFILES\\MSOFFICE\\OFFICE\\EXCEL.exe H:\\cad4\\support\\Test-Excel.xls")

;;;This is the new path that does not work
(command "shell" "C:\\Program Files\\Microsoft Excel\\Office11\\Excel.exe H:\\Cad4\\support\\Test-Excel.xls"

(SETVAR "CMDECHO" 1)
(princ)
)

Is there a way to protect the path that contains the spaces.....??

Any assistance would be appreciated.

Regards,
Vince

ccowgill
2006-02-09, 11:26 PM
try using / instead of \\
or the old dos way -> c:\\progra~1

miff
2006-02-09, 11:53 PM
Hi Vince,
you need to get the path enclosed in quotes:

"\"C:\\Program Files\\Microsoft Excel\\Office11\\Excel.exe\" H:\\Cad4\\support\\Test-Excel.xls"
HTH,
Jeff

Opie
2006-02-10, 04:33 AM
Have a look at this thread (STARTAPP ???). I think it will be helpful.

kennet.sjoberg
2006-02-10, 10:13 AM
Replace the old shell stuff :
(command "shell" "C:\\Program Files\\Microsoft Excel\\Office11\\Excel.exe H:\\Cad4\\support\\Test-Excel.xls" )

with :
(startapp "C:\\Program Files\\Microsoft Excel\\Office11\\Excel.exe H:\\Cad4\\support\\Test-Excel.xls" )

: ) Happy Computing !

kennet

vferrara
2006-02-10, 02:39 PM
Jeff, Ken, Opie, Chris:

Thank you for your quick response........Your recommendations provided a good solution for me and works fine in my environment.

Once again I would like to thank everyone for your assistance.....!!!!

Regards,
Vince