



The current position that VBA has got to will be highlighted with yellow. The pause button will pause execution, and take you to the debugging screen. the subroutine in the module you’re editing that contains the cursor). The run button causes VBA to start executing code from the current subroutine (i.e. The section of the screen represented by the number 4 is a toolbar – in particular the buttons that handle the execution of code. When you add a module, it automatically opens it up in the editing portion of the screen.

If you’ve added a module, chances are you’re looking at a white screen, and you can type stuff. If it’s grey at the moment (like in the example), you’re not editing anything. The section of the screen represented by the number 3 is the editing window. Various aspects of your project have certain properties that can be edited. The section of the screen represented by the number 2 is the properties window. If you like, you can rename the module from “Module1” to something more descriptive of what the module does or is for. A module is basically a container for your code. This will (surprisingly!) insert a module. Right click in this area and select insert/module. This shows you all the sections of your VBA project. The section of the screen with the big red “1” is the project window. You should have something that looks like the below: This opens up a new window which is the VBA IDE. In order to begin, we need to access the VBA IDE. The “for Applications” bit means that it is integrated behind the scenes in the software application you’re using, be it Word, Excel, or in our case AutoCAD. Most people reading this will probably have heard of Visual Basic, and are aware that it is a Microsoft Windows based programming language. VBA stands for Visual Basic for Applications. If I assume you know nothing about VBA, it follows that you probably don’t know what VBA stands for. I will give a brief overview of the VBA IDE (Integrated Development Environment) and I will explain a small snippet of code and how it works. I will explain the very basics of using VBA in AutoCAD®. This tutorial assumes no previous knowledge of VBA in AutoCAD® or otherwise. Especially since VB stands for “Visual Basic” – there’s a clue in the name… Writing simple applications for automating tasks isn’t hard – really. Before you cringe with dread at the prospect of having to learn a programming language, it sounds far more difficult than it really is. Knowing a little bit of programming can be extremely useful in the AutoCAD® environment.
