Visual LISP, AutoLISP and General Customization

Posts: 19
Registered: ‎03-27-2012
Message 1 of 3 (265 Views)
Accepted Solution

Excel Message - Cannot find file

265 Views, 2 Replies
10-22-2012 09:51 AM

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.



Valued Contributor
Posts: 85
Registered: ‎07-25-2012
Message 2 of 3 (254 Views)

Re: Excel Message - Cannot find file

10-22-2012 11:09 AM 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.





Posts: 19
Registered: ‎03-27-2012
Message 3 of 3 (252 Views)

Re: Excel Message - Cannot find file

10-22-2012 11:18 AM in reply to: Rick-K

Thanks! That will work.

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community