TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Mikosalm on September 26, 2019, 01:10:23 PM
-
Hi Everyone,
I am having trouble creating an excel object. The below line works on all of our workstations except one in which it returns nil.
(setq xl (vlax-get-or-create-object "Excel.Application"))
Excel is installed on the computer and I can open the workbook manually. Anyone know how to correct this?
-
The specified progid is incorrect, like missing a version number. e.g. "Excel.Application.14".
See this (http://www.theswamp.org/index.php?topic=52397.msg573363#msg573363) thread.
Cheers.
-
Thanks for the response MP
The proid works without the version number on other similar workstations so I am not sure why it would be needed here.
Tried it anyways though and it still returns nil. Using Office 2016 so I tried "Excel.Application.16" as well as what you suggested.
-
Did you try the utility I referenced, e.g. (mapcar 'print (_FindProjIDs "*excel*")) and if so what was the result?
-
Hey MP,
This was the returned result: "AdobePDFMakerX.ExcelSheetsDlg" ("AdobePDFMakerX.ExcelSheetsDlg")
-
Surely more than that was returned, especially if excel is installed as you say.
-
Did you try the utility I referenced, e.g. (mapcar 'print (_FindProjIDs "*excel*")) and if so what was the result?
I used that utility a few weeks ago to find all possible progids to use in autocad (used "*"). I tested vlax-create-object on each one. Not all of them worked, some returned errors, others simply nil. A couple of them took so long to create it was like an infinite loop.
Surely more than that was returned, especially if excel is installed as you say.
What if there is a case where you can have excel installed, but activeX is disabled?
-
Not all progids are associated with an application executable, nor are all instantiable.
I can’t speak to an AutoCAD instance where ActiveX has been disabled because I’ve not encountered that scenario.
Cheers.
-
Surely more than that was returned, especially if excel is installed as you say.
What's the expected result? I am getting the above on a workstation which can create an Excel object as well.
I can see that Excel is in the registry and I am also able to create objects for other Office applications like Outlook.
("Word" "Teams" "PowerPoint" "Outlook" "OneNote" "Lync" "Excel" "DmsClient" "Common" "8.0" "16.0" "15.0" "14.0" "12.0" "11.0")
What if there is a case where you can have excel installed, but activeX is disabled?
Wouldn't that prevent macro's from running as well? Excel appears to be fully functional.
-
I'd expect to see a list of matching progids for a spec of "*excel*", something like:
"Excel.Application.14"
"Excel.Chart.5"
"Excel.Chart.8"
"Excel.ChartApplication.14"
"Excel.OpenDocumentSpreadsheet.12"
"Excel.Sheet.12"
"Excel.Sheet.5"
"Excel.Sheet.8"
"Excel.SheetBinaryMacroEnabled.12"
"Excel.SheetMacroEnabled.12"
"ExcelAddIn.Connect.15"
"ExcelAddIn.Connect.5"
"ExcelChart"
"ExcelMacrosheet"
"ExcelWorksheet"
"VS15ExcelAdaptor.1"
Not:
"AdobePDFMakerX.ExcelSheetsDlg"
Don't know what to tell you.
-
Turns out the error was unrelated to AutoCAD. It was fixed by repairing the Office install.
Unsure why your function isn't working though.
Thank you for the responses.
-
I respectfully submit - the function works - your registry is/was wack - glad you appear to have it sorted.
-
Hi. I had the same problem with Excel a few days ago. I'm really sorry for bumping. Just need your help.
-
With excel 2 scenarios is open or is not
(or (setq myxl (vlax-get-object "Excel.Application"))
(setq myxl (vlax-get-or-create-object "excel.Application"))
)
(vla-put-visible myXL :vlax-true)
(vlax-put-property myxl 'ScreenUpdating :vlax-true)
(vlax-put-property myXL 'DisplayAlerts :vlax-true)
-
Hey. Have you tried updating your Office version to the latest one? That might solve the issue. By the way, have you checked out Office 2021 Professional Plus for Windows? It's the latest and greatest version with all the bells and whistles. I'm new on this forum, but I can tell you that turnkeypoint.com (https://turnkeypoint.com/product/office-2021-professional-plus-for-windows/) is a great resource for all things tech-related. Hope this helps!
-
(and (setq GGG
(vl-registry-read
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\Excel.EXE"
"Path"
)
)
(setq GGG (strcase (strcat GGG "Excel.EXE" )))
)