Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Excel Message - Cannot find file

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
nothin
602 Views, 2 Replies

Excel Message - Cannot find file

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.

 

Please help.

 

I have attached a sample lisp file and excel file that can be used to see what error message I am getting.

 

Thanks.

2 REPLIES 2
Message 2 of 3
Rick-K
in reply to: nothin

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.

 

Rick

 

 

Message 3 of 3
nothin
in reply to: Rick-K

Thanks! That will work.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

”Boost