Results 1 to 6 of 6

Thread: Problem Running Excel From AutoCAD Shell Command

  1. #1
    I could stop if I wanted to
    Join Date
    2015-09
    Posts
    420
    Login to Give a bone
    0

    Default Problem Running Excel From AutoCAD Shell Command

    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

  2. #2
    Certifiable AUGI Addict ccowgill's Avatar
    Join Date
    2004-08
    Location
    Iron Station, NC
    Posts
    3,198
    Login to Give a bone
    0

    Default Re: Problem Running Excel From AutoCAD Shell Command

    try using / instead of \\
    or the old dos way -> c:\\progra~1

  3. #3
    All AUGI, all the time
    Join Date
    2015-12
    Location
    Central Oregon
    Posts
    591
    Login to Give a bone
    0

    Default Re: Problem Running Excel From AutoCAD Shell Command

    Hi Vince,
    you need to get the path enclosed in quotes:
    Code:
    "\"C:\\Program Files\\Microsoft Excel\\Office11\\Excel.exe\" H:\\Cad4\\support\\Test-Excel.xls"
    HTH,
    Jeff

  4. #4
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,100
    Login to Give a bone
    0

    Default Re: Problem Running Excel From AutoCAD Shell Command

    Have a look at this thread (STARTAPP ???). I think it will be helpful.
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  5. #5
    AUGI Addict kennet.sjoberg's Avatar
    Join Date
    2002-05
    Posts
    1,707
    Login to Give a bone
    0

    Default Re: Problem Running Excel From AutoCAD Shell Command

    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

  6. #6
    I could stop if I wanted to
    Join Date
    2015-09
    Posts
    420
    Login to Give a bone
    0

    Default Re: Problem Running Excel From AutoCAD Shell Command

    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

Similar Threads

  1. Replies: 5
    Last Post: 2013-10-16, 05:39 PM
  2. Windows XP - problem running Autocad 2008 on a XP virtual machine
    By radin.hairul.anwar in forum Operating Systems
    Replies: 3
    Last Post: 2008-05-14, 09:25 AM
  3. Replies: 6
    Last Post: 2007-01-08, 01:12 PM
  4. Old DOS Shell Command
    By eschwartz in forum AutoLISP
    Replies: 4
    Last Post: 2005-10-31, 06:03 PM
  5. problem running AutoCAD Mechanical 2004
    By iffans in forum AutoCAD Mechanical - General
    Replies: 1
    Last Post: 2004-12-05, 06:12 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •