Excel Message - Cannot find file
I am using a lisp file that I found on a CAD forum to grab data from an excel file. I have tweeked it a little to meet my needs. The location of the excel file is hard wired into the lisp file. It is not an option for the user. However, if the user does not have access to the location where the excel file is being stored an excel error message will pop up saying that the file could not be found (see JPG file attached).
I need to find a way to keep this error message from popping up. I have set up the program to let the user specify the location of the file if the file is not found, but I still get this error message.
It would be nice if there was a way to have the program take the location specified and look to see if there is a file at that location, but not try to open the file. Then I could use some logic to decide if the location hard wired into the program should be used or if the user should specify the location. Then I'd avoid the error altogether.
I have attached a sample lisp file and excel file that can be used to see what error message I am getting.
Solved! Go to Solution.
Try testing if your file is there by using findfile.
(setq IsMyFileThere (findfile "G:\\MetaClas DataBase\\METACLAS_XREF_DATA_.xlsx"))
If it returns nil then it cannot find your file.
Then you could redirect it to the open file dialog using getfiled to let the user select a file.
Sorry I cant be more help than that but I have only tweaked a lisp that uses these.