- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello everyone! I'm working on a lisp command that will open an premade excel file, read some contained information (length, width, etc), and then draw a structure based off that info. However, the excel files this command will be reading from all contain faulty VBA code. When a file is opened "manually" (like double clicking on it in file explorer), Excel displays a message below the ribbon about security disabling some active content. If you enable the content, a VBA compiler opens and displays "Compile error: Can't find project or library". The user can't access the excel file until closing out of the warning and closing the compiler with another accompanying warning. Okay, if you want to access information from the excel file, just don't enable that content.
The problem is that when opening excel via AutoLISP (I am using Jeffery Sander's GetCells function, also attached to this post) excel always tries to run that active content, resulting in the compiler opening and the error appearing, causing the command to pause until all those warnings are closed.
So, the question: Is there some vlax property or other command I can use to prevent excel from running that code when opening a file?
I have found that if the excel file is already opened, excel does not attempt to run the faulty VBA code, and the command executes correctly. However, part of my goal with this command is to save the user as much time and effort as possible. Needing the user to navigate to and open the excel file beforehand defeats part of that purpose, in my opinion.
Editing the excel files to remove the faulty VBA code does work, but this would require every user to open the file beforehand and then delete a section of code (see above point), or would need management to allow a change to the base template that these excel files are based on.
Thank you for your time!
Solved! Go to Solution.