Author Topic: Loop Through multiple AutoCAD Files and Run a particular LISP on each File  (Read 515 times)

0 Members and 1 Guest are viewing this topic.


  • Bull Frog
  • Posts: 344
Dear All,

I have successfully managed to create an application in Excel VBA by which we can Loop Through multiple AutoCAD Files and Run a particular LISP on each File. Thought of sharing it so that it might be helpful to many.
How to Use :-
1.) Make Your LISP File and save it at any location (folder) in your computer. At the end of your lisp file, you must add a command to run the LISP every time it is loaded. For example in the below example, after the LISP code, I have added a call to the LISP function:-
Code: [Select]
(defun c:MyLISP()

2.) Open the AutoCAD Application. Only the application needs to be opened but dont open any file.
3.) Open Excel File. If you have AutoCAD 2014 installed on your machine, directly go to Step 7.
4.) Press Alt+F11. 'Microsoft Visual Basic for Applications' window will open.
5.) Go to 'Tools' Menu and select 'References' option. In the attached screenshot, 'AutoCAD 2014 Type Library' is checked. If you have different AutoCAD version, uncheck this option and find and check your respective 'AutoCAD xxxx Type Library'.
6.) Close the window and save the File.
7.) Press the Button on 'Sheet1'. It will ask to select AutoCAD files to be selected, you may select multiple files in one go. After selection is complete, press 'Open'.
8.) Now it will ask you to select your LISP file (which you want to run on each AutoCAD file). Select that LISP file and Press 'Open'
9.) Your work is Done !!!

Now the program will open each AutoCAD file and load the lisp file one by one. Since you have already added the call to your LISP function at the end of the LISP file, it will automatically get executed as soon as it is loaded.
One by one, the files shall be opened, LISP file shall execute, file shall be saved and closed.
I hope this helps.
« Last Edit: October 08, 2016, 02:02:59 am by mailmaverick »