Author Topic: Open excel file (*.xlsx) with autocad command  (Read 849 times)

0 Members and 1 Guest are viewing this topic.

pedroantonio

  • Guest
Open excel file (*.xlsx) with autocad command
« on: January 12, 2018, 04:03:51 PM »
Hi .I have an (*.xlsx) file in a folder with the name Test in C drive. I am using Autocad 2017 and Office  2016

I write the command

Code: [Select]
^c^c(startapp C:\\Program Files (x86)\\Microsoft Office\\root\\Office16\" \"C:\\Test\\My test.xlsx\"")

and gives me this error

Quote
Unknown command STARTAPP

Any ideas
« Last Edit: January 12, 2018, 04:07:04 PM by Topographer »

dubb

  • Swamp Rat
  • Posts: 1073
Re: Open excel file (*.xlsx) with autocad command
« Reply #1 on: January 12, 2018, 04:34:01 PM »
Try this
Code: [Select]
(startapp "C:/Program Files (x86)/Microsoft Office/root/Office16/excel.exe" "\"C:\\Test\\My test.xlsx\"")
Hi .I have an (*.xlsx) file in a folder with the name Test in C drive. I am using Autocad 2017 and Office  2016

I write the command

Code: [Select]
^c^c(startapp C:\\Program Files (x86)\\Microsoft Office\\root\\Office16\" \"C:\\Test\\My test.xlsx\"")

and gives me this error

Quote
Unknown command STARTAPP

Any ideas

Master_Shake

  • Swamp Rat
  • Posts: 1447
Re: Open excel file (*.xlsx) with autocad command
« Reply #2 on: January 12, 2018, 04:34:31 PM »
Well, the full path is required, including excel.exe. Second, the unknown command is triggering as it's the default error that the command did not run properly.

ronjonp

  • Needs a day job
  • Posts: 7125
Re: Open excel file (*.xlsx) with autocad command
« Reply #3 on: January 12, 2018, 04:51:53 PM »
Alternatively:

Code - Auto/Visual Lisp: [Select]
  1. (defun _openfile (file / sh)
  2.   (setq sh (vlax-get-or-create-object "Shell.Application"))
  3. )
  4. (_openfile "C:\\Test\\My test.xlsx")

Windows 10 x64 - AutoCAD /C3D 2020

Custom Build PC

Grrr1337

  • Swamp Rat
  • Posts: 727
Re: Open excel file (*.xlsx) with autocad command
« Reply #4 on: January 12, 2018, 04:56:26 PM »
This was suggested by Lee Mac:
Code - Auto/Visual Lisp: [Select]
  1. (startapp (vl-registry-read (strcat "HKEY_CLASSES_ROOT\\" (vl-registry-read "HKEY_CLASSES_ROOT\\.xls") "\\shell\\new\\command")))
(apply ''((a b c)(a b c))
  '(
    (( f L ) (apply 'strcat (f L)))
    (( L ) (if L (cons (chr (car L)) (f (cdr L)))))
    (72 101 108 108 111 32 87 111 114 108 100)
  )
)

pedroantonio

  • Guest
Re: Open excel file (*.xlsx) with autocad command
« Reply #5 on: January 12, 2018, 05:11:45 PM »
Thank you for the help